Dépannage de l'agent « Instana » sur Red Hat OpenShift

Consultez les solutions aux problèmes courants rencontrés avec l'agent hôte sur Red Hat OpenShift :

La réinstallation de l'agent échoue et affiche un message d'erreur

Si la réinstallation échoue avec le message suivant, supprimez les objets de niveau cluster de l'agent avant de réinstaller l'agent :

installation Instana Agent failed: rendered manifests contain a resource that already exists. Unable to continue with install: ...

Pour plus d'informations sur la suppression des objets de niveau cluster de l'agent, consultez la section « Désinstallation de l'agent ».

Modules d'agent non planifiés

Une fois que vous avez installé l'agent Instana, le graphique « Helm » ou l'opérateur, vous remarquerez peut-être que les pods de l'agent instana-agent-<xxxxx> ne sont pas déployés comme prévu. Ce problème pourrait être dû à des autorisations manquantes.

Une fois l'installation terminée, il faut compter un court délai avant que les nœuds ne soient visibles. Ce retard est dû au fait que l'agent doit commencer à établir son rapport. Toutefois, si le problème est dû à des autorisations manquantes, vous remarquerez que l'onglet « Infrastructure » du cluster « Kubernetes » n'affiche aucun nœud, même après quelques minutes d'installation.

En cas d'installation problématique, seuls les k8sensor pods sont planifiés et les pods de l'agent ne sont pas visibles.

$ kubectl get pods -n instana-agent
NAME                                      READY   STATUS    RESTARTS   AGE
controller-manager-5775896db6-v5qh7       1/1     Running   0          2m52s
controller-manager-5775896db6-zrd7l       1/1     Running   0          2m52s
instana-agent-k8sensor-76db46875c-px8cj   1/1     Running   0          2m48s
instana-agent-k8sensor-76db46875c-xknnw   1/1     Running   0          2m48s
instana-agent-k8sensor-76db46875c-zdrt9   1/1     Running   0          2m48s

Vous pouvez décrire l'agent Daemonset pour identifier le problème. Voir l'exemple suivant :

$ kubectl get ds -n instana-agent
NAME            DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
instana-agent   3         0         0       0            0           <none>          3m11s

$ kubectl describe ds instana-agent -n instana-agent
...
Events:
  Type     Reason        Age                    From                  Message
  ----     ------        ----                   ----                  -------
  Warning  FailedCreate  7m27s (x3 over 7m27s)  daemonset-controller  Error creating: pods "instana-agent-" is forbidden: error looking up service account instana-agent/instana-agent: serviceaccount "instana-agent" not found
  Warning  FailedCreate  2m (x14 over 7m27s)    daemonset-controller  Error creating: pods "instana-agent-" is forbidden: unable to validate against any security context constraint: [provider "anyuid": Forbidden: not usable by user or serviceaccount, provider restricted-v2: .spec.securityContext.hostNetwork: Invalid value: true: Host network is not allowed to be used, provider restricted-v2: .spec.securityContext.hostPID: Invalid value: true: Host PID is not allowed to be used, spec.volumes[0]: Invalid value: "hostPath": hostPath volumes are not allowed to be used, spec.volumes[1]: Invalid value: "hostPath": hostPath volumes are not allowed to be used, spec.volumes[2]: Invalid value: "hostPath": hostPath volumes are not allowed to be used, spec.volumes[3]: Invalid value: "hostPath": hostPath volumes are not allowed to be used, spec.volumes[4]: Invalid value: "hostPath": hostPath volumes are not allowed to be used, spec.volumes[5]: Invalid value: "hostPath": hostPath volumes are not allowed to be used, spec.volumes[6]: Invalid value: "hostPath": hostPath volumes are not allowed to be used, spec.volumes[7]: Invalid value: "hostPath": hostPath volumes are not allowed to be used, provider restricted-v2: .containers[0].privileged: Invalid value: true: Privileged containers are not allowed, provider restricted-v2: .containers[0].hostNetwork: Invalid value: true: Host network is not allowed to be used, provider restricted-v2: .containers[0].containers[0].hostPort: Invalid value: 42699: Host ports are not allowed to be used, provider restricted-v2: .containers[0].containers[0].hostPort: Invalid value: 55680: Host ports are not allowed to be used, provider restricted-v2: .containers[0].containers[0].hostPort: Invalid value: 4317: Host ports are not allowed to be used, provider restricted-v2: .containers[0].containers[0].hostPort: Invalid value: 4318: Host ports are not allowed to be used, provider restricted-v2: .containers[0].hostPID: Invalid value: true: Host PID is not allowed to be used, provider "restricted": Forbidden: not usable by user or serviceaccount, provider "nonroot-v2": Forbidden: not usable by user or serviceaccount, provider "nonroot": Forbidden: not usable by user or serviceaccount, provider "hostmount-anyuid": Forbidden: not usable by user or serviceaccount, provider "machine-api-termination-handler": Forbidden: not usable by user or serviceaccount, provider "hostnetwork-v2": Forbidden: not usable by user or serviceaccount, provider "hostnetwork": Forbidden: not usable by user or serviceaccount, provider "hostaccess": Forbidden: not usable by user or serviceaccount, provider "node-exporter": Forbidden: not usable by user or serviceaccount, provider "privileged": Forbidden: not usable by user or serviceaccount]

Pour résoudre le problème, ajoutez la contrainte privileged de contexte de sécurité au compte instana-agent de service en exécutant la commande suivante :

oc adm policy add-scc-to-user privileged -z instana-agent -n instana-agent
oc adm policy add-scc-to-user anyuid -z instana-agent-remote -n instana-agent

Kubernetes le système tente de planifier périodiquement les pods défaillants, et les pods agents sont déployés lors des itérations suivantes. Pour accélérer ce processus, vous pouvez supprimer manuellement l' DaemonSet, de l'agent; l'opérateur de l'agent Instana se chargera alors de déployer une nouvelle DaemonSet. Voir l'exemple suivant :

$ kubectl delete ds instana-agent -n instana-agent
daemonset.apps "instana-agent" deleted

$ kubectl get pods -n instana-agent
NAME                                      READY   STATUS    RESTARTS   AGE
controller-manager-5775896db6-v5qh7       1/1     Running   0          18m
controller-manager-5775896db6-zrd7l       1/1     Running   0          18m
instana-agent-5592d                       1/1     Running   0          19s
instana-agent-8qh9g                       1/1     Running   0          19s
instana-agent-k8sensor-76db46875c-px8cj   1/1     Running   0          18m
instana-agent-k8sensor-76db46875c-xknnw   1/1     Running   0          18m
instana-agent-k8sensor-76db46875c-zdrt9   1/1     Running   0          18m
instana-agent-rngh4                       1/1     Running   0          19s

$ kubectl get ds -n instana-agent
NAME            DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
instana-agent   3         3         3       3            3           <none>          24s

Pour obtenir des informations générales sur le dépannage de tous les agents hôtes, consultez la section « Gestion des agents hôtes : dépannage ».