Administering the Instana agent on Red Hat OpenShift
After you install the agent, configure and manage the agent as you require. See the following list for all the available agent configuration options on Red Hat OpenShift.
Checking the pod status
After you install the agent, you can check the status of the pods in your agent deployment by using the following commands:
kubectl get pods -n instana-agent
kubectl get agent instana-agent -n instana-agent -o yaml | yq ".status"
In a good deployment, the STATUS
of all the pods in the namespace must be Running
. The instana-agent
custom resource should also display status: Running
, as show in the following example:
$ kubectl get pods -n instana-agent
NAME READY STATUS RESTARTS AGE
controller-manager-6478cb4c6f-8s29b 1/1 Running 0 70m
instana-agent-8ftnj 1/1 Running 0 70m
instana-agent-9w4vc 1/1 Running 0 70m
instana-agent-k8sensor-5bbf568976-5pjk2 1/1 Running 0 3h2m
instana-agent-k8sensor-5bbf568976-h96hr 1/1 Running 0 3h2m
instana-agent-k8sensor-5bbf568976-lnbsg 1/1 Running 0 3h2m
instana-agent-zpmrj 1/1 Running 0 70m
$ kubectl get agent instana-agent -n instana-agent -o yaml | yq ".status"
conditions:
- lastTransitionTime: "2024-08-06T08:12:03Z"
message: most recent reconcile of agent CR completed without issue
observedGeneration: 2
...
observedGeneration: 2
oldVersionsUpdated: true
operatorVersion: 0.0.1-dev
status: Running
Configuring the agent
You can configure the Instana agent for Kubernetes and Red Hat OpenShift in two different ways, depending on the method that you used to install the agent.
Configuring agent installed by using operator
To configure the Instana agent that is installed by using an operator, complete the following steps:
-
Open the custom resource YAML file
instana-agent.customresource.yaml
. -
Save your configurations under
spec.agent.configuration_yaml
. See the following example:spec: agent: configuration_yaml: | # Example of configuration yaml template # Host com.instana.plugin.host: tags: - 'dev' - 'app1'
-
Apply the changes by running the following command:
kubectl apply -f instana-agent.customresource.yaml
For a detailed example of the YAML file, see instana_v1_extended_instanaagent.yaml.
For more information about agent configuration, see Configuring host agents by using the agent configuration file.
Configuring agent installed by using Helm chart
To configure the Instana agent that is installed by using Helm chart, choose either of the following methods:
-
Specify the configuration on the command line by using the flag
--set agent.configuration_yaml=<config>
. -
Add the configuration to the Helm chart configuration file
values.yaml
. Pass the file to the Helm install (during installation) or Helm upgrade (after installation) command by using the-f
flag.
For a detailed list of all the configuration parameters, see Instana Helm Chart.
Customizing the Container Registry
Depending on your Red Hat OpenShift environment, you might need to customize the Red Hat OpenShift Container Registry.
Adding image streams
If you cannot pull images from the IBM Cloud Container Registry (icr.io), you need to manually add two image streams. In the Red Hat OpenShift Container Registry, go to the instana-agent
namespace and add the following image streams:
Name: instana-agent
Image: icr.io/instana/agent:latest
The resulting image stream is docker-registry.default.svc:5000/instana-agent/instana-agent:latest
.
Name: k8sensor
Image: icr.io/instana/k8sensor:latest
The resulting image stream is docker-registry.default.svc:5000/instana-agent/k8sensor:latest
.
Use the respective new image streams in the YAML.
Customizing the monitoring with ConfigMap
You can customize the monitoring as you require by configuring the agent.configuration_yaml
file. For more information, see Configuration Reference.
For more information about the configuration, see Configuring host agent.
Updating the agent installation
Depending on your method of installation, you can update the Instana agent for Red Hat OpenShift in multiple ways.
Updating an operator installation
Updating the agent installation involves two steps:
- Updating the operator
- Updating the images
To update the operator to the latest version by using OLM, follow the steps described in the Manually approving a pending Operator update section in the Red Hat OpenShift documentation.
You can also configure the operator to update automatically. For more information, see Changing the update channel for an Operator.
To update the operator manually by using the Instana UI, complete the following steps:
-
On the home page of the Instana UI, click Deploy Agent.
-
On the agent deployment catalog page, click the tile OpenShift - Operator.
-
Copy and run the command to deploy the new operator. See the following command sample:
kubectl apply -f https://github.com/instana/instana-agent-operator/releases/latest/download/instana-agent-operator.yaml
After the operator is updated, proceed to updating the images.
Updating a Helm chart installation
Updating the agent installation involves two steps:
- Updating Helm chart
- Updating the images
To update the agent Helm chart, run the following commands:
helm pull --repo https://agents.instana.io/helm --untar instana-agent; kubectl apply -f instana-agent/crds; oc adm policy add-scc-to-user privileged -z instana-agent -n instana-agent; helm upgrade --namespace instana-agent instana-agent \
--repo https://agents.instana.io/helm instana-agent \
--reuse-values
Instana agent Helm charts version 2.0.0 and earlier do not have the instana-agent/crds
folder. Therefore, the kubectl apply -f instana-agent/crds
step is not required.
After the operator is updated, proceed to updating the images.
Updating Instana agent images
The instana-agent
DaemonSet and k8sensor
deployment are set to pull the latest image on pod startup. To force the update, run the following commands:
kubectl rollout restart ds instana-agent -n instana-agent
kubectl rollout restart deployment k8sensor -n instana-agent
Managing agents by using the Agent Management dashboard
You can complete the following operations by using the Agent Management dashboard in the Instana UI:
- Changing agent modes
- Changing log level
- Updating agents
- Resetting agents
- Rebooting agents
- Viewing sensors
- Configuration management
- Self-monitoring
To open the Agent Management dashboard, follow the steps:
- In the sidebar of the Instana UI, select Infrastructure.
- Click a specific monitored host.
- On the host dashboard, click Open Agent Management.
Configuring network access for monitored applications
You must configure the network access of the following types of applications for them to communicate with the agent:
- Node.js
- Go
- Ruby
- Python
- .NET Core
These applications need to know the IP that the agent listens. The agent listens on the host IP automatically. You can use the following Downward API snippet to pass the host IP in an environment variable to the application pod:
spec:
containers:
env:
- name: INSTANA_AGENT_HOST
valueFrom:
fieldRef:
fieldPath: status.hostIP
Monitoring master nodes
By default, the agent does not get scheduled on Kubernetes master nodes, because the deployment respects the default taint node-role.kubernetes.io/master:NoSchedule
that is set on most master nodes. To monitor master nodes, add
the following toleration to the agent DaemonSet:
kind: DaemonSet
metadata:
name: instana-agent
namespace: instana-agent
spec:
template:
...
spec:
tolerations:
- key: "node-role.kubernetes.io/master"
effect: "NoSchedule"
operator: "Exists"
...
For more direct control, install the agent separately on the master nodes. Contact IBM Support for more support for your environment.
Monitoring Kubernetes NGINX Ingress
For guidelines on how to configure the Kubernetes NGINX Ingress and our Agent for capturing NGINX metrics, see the Monitoring NGINX page. Tracing of the Kubernetes NGINX Ingress is also possible via the OpenTracing project, see Distributed Tracing for NGINX Ingress on guidelines how to set that up.
Reporting to multiple backends
To add additional backends by using helm and operator, run the following command. You can use additional backends to configure your Instana agent or leave it empty.
When you run the following command, the agent data is forwarded to multiple backends, along with Kubernetes data and metrics data.
-
Using helm:
helm install instana-agent \ --repo https://agents.instana.io/helm \ --namespace instana-agent \ --create-namespace \ --set agent.key=my-key \ --set agent.endpointHost='<your_host_agent_endpoint>' \ --set agent.endpointPort=443 \ --set cluster.name='<your_cluster_name>' \ --set zone.name='zone-name' \ --set "agent.additionalBackends[0].endpointHost=<your_host_agent_endpoint>" \ --set "agent.additionalBackends[0].key=<your_agent_key>" \ --set "agent.additionalBackends[0].endpointPort=443" \ --set "agent.additionalBackends[1].endpointHost=<your_other_host_agent_endpoint>" \ --set "agent.additionalBackends[1].key=<your_other_agent_key>" \ --set "agent.additionalBackends[1].endpointPort=443" \ instana-agent
-
Using operator:
apiVersion: instana.io/v1 kind: InstanaAgent metadata: name: instana-agent namespace: instana-agent spec: zone: name: edited-zone # (optional) name of the zone of the host cluster: name: my-cluster agent: endpointHost: <your_host_agent_endpoint> endpointPort: "443" env: {} key: <your_agent_key> additionalBackends: - endpointHost: <your_host_agent_endpoint> endpointPort: "443" key: <your_agent_key> configuration_yaml: | # You can leave this empty, or use this to configure your instana agent. # See https://github.com/instana/instana-agent-operator/blob/main/config/samples/instana_v1_extended_instanaagent.yaml for the extended version.
To enable reporting to multiple backends from a Kubernetes agent, see the Docker agent configuration.
Configuring Secrets
You can use Secrets to store and manage sensitive data such as credentials, tokens, or keys. See Kubernetes secrets for more details.