datadog-agent icon indicating copy to clipboard operation
datadog-agent copied to clipboard

Stuck in CrashLoopBackOff on single node in EKS Cluster

Open kencieszykowski opened this issue 7 years ago • 4 comments

So, first off-- I cannot get into the container to run a status operation. Here is what I get when I describe the pod:

Output of the info page (if this is a bug)

Name:               datadog-agent-qqlrn
Namespace:          datadog-agent
Priority:           0
PriorityClassName:  <none>
Node:               ip-172-30-29-144.ec2.internal/172.30.29.144
Start Time:         Thu, 15 Aug 2019 13:53:59 -0700
Labels:             app=datadog-agent
                    app.kubernetes.io/managed-by=spinnaker
                    app.kubernetes.io/name=kubernetestools
                    controller-revision-hash=77bf7b46c8
                    pod-template-generation=1
Annotations:        artifact.spinnaker.io/location: datadog-agent
                    artifact.spinnaker.io/name: datadog-agent
                    artifact.spinnaker.io/type: kubernetes/daemonSet
                    kubernetes.io/psp: eks.privileged
                    moniker.spinnaker.io/application: kubernetestools
                    moniker.spinnaker.io/cluster: daemonSet datadog-agent
Status:             Running
IP:                 172.30.25.133
Controlled By:      DaemonSet/datadog-agent
Containers:
  datadog-agent:
    Container ID:   docker://xxxx
    Image:          datadog/agent:latest-jmx
    Image ID:       docker-pullable://datadog/agent@sha256:xxxxxxx
    Ports:          8125/UDP, 8126/TCP
    Host Ports:     8125/UDP, 8126/TCP
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Thu, 15 Aug 2019 15:39:42 -0700
      Finished:     Thu, 15 Aug 2019 15:41:05 -0700
    Ready:          False
    Restart Count:  29
    Limits:
      cpu:     200m
      memory:  1Gi
    Requests:
      cpu:     200m
      memory:  512Mi
    Liveness:  exec [./probe.sh] delay=15s timeout=1s period=5s #success=1 #failure=3
    Environment:
      DD_API_KEY:                      <set to the key 'api-key' in secret 'datadog-secret-config'>  Optional: false
      DD_SITE:                         datadoghq.com
      DD_COLLECT_KUBERNETES_EVENTS:    true
      DD_LEADER_ELECTION:              true
      KUBERNETES:                      true
      DD_KUBERNETES_KUBELET_HOST:       (v1:status.hostIP)
      DD_APM_ENABLED:                  true
      DD_TAGS:                         cluster_name:stage-eks-stateful-test
      DD_DOGSTATSD_NON_LOCAL_TRAFFIC:  true
      DD_DOGSTATSD_ORIGIN_DETECTION:   true
      SD_JMX_ENABLE:                   true
    Mounts:
      /host/proc from procdir (ro)
      /host/sys/fs/cgroup from cgroups (ro)
      /var/lib/docker/containers from logcontainerpath (rw)
      /var/log/pods from logpodpath (rw)
      /var/run/datadog from dsdsocket (rw)
      /var/run/docker.sock from dockersocket (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from datadog-agent-token-jwjbv (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  dockersocket:
    Type:          HostPath (bare host directory volume)
    Path:          /var/run/docker.sock
    HostPathType:
  procdir:
    Type:          HostPath (bare host directory volume)
    Path:          /proc
    HostPathType:
  logpodpath:
    Type:          HostPath (bare host directory volume)
    Path:          /var/log/pods
    HostPathType:
  logcontainerpath:
    Type:          HostPath (bare host directory volume)
    Path:          /var/lib/docker/containers
    HostPathType:
  cgroups:
    Type:          HostPath (bare host directory volume)
    Path:          /sys/fs/cgroup
    HostPathType:
  dsdsocket:
    Type:          HostPath (bare host directory volume)
    Path:          /var/run/datadog/
    HostPathType:
  datadog-agent-token-jwjbv:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  datadog-agent-token-jwjbv
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/disk-pressure:NoSchedule
                 node.kubernetes.io/memory-pressure:NoSchedule
                 node.kubernetes.io/not-ready:NoExecute
                 node.kubernetes.io/unreachable:NoExecute
                 node.kubernetes.io/unschedulable:NoSchedule
                 special=true:NoSchedule
Events:
  Type     Reason     Age                 From                                    Message
  ----     ------     ----                ----                                    -------
  Warning  Unhealthy  52m (x6 over 106m)  kubelet, ip-172-30-29-144.ec2.internal  Liveness probe failed: Agent health: FAIL
=== 1 healthy components ===
healthcheck
=== 9 unhealthy components ===
ad-config-provider-docker, ad-config-provider-kubernetes, ad-kubeletlistener, ad-servicelistening, aggregator, dogstatsd-main, forwarder, tagger, tagger-docker
Error: found 9 unhealthy components
  Warning  Unhealthy  18m (x18 over 107m)  kubelet, ip-172-30-29-144.ec2.internal  Liveness probe failed: Agent health: FAIL
=== 1 healthy components ===
healthcheck
=== 10 unhealthy components ===
ad-config-provider-docker, ad-config-provider-kubernetes, ad-dockerprovider, ad-kubeletlistener, ad-servicelistening, aggregator, dogstatsd-main, forwarder, tagger, tagger-docker
Error: found 10 unhealthy components
  Warning  BackOff    8m1s (x265 over 98m)   kubelet, ip-172-30-29-144.ec2.internal  Back-off restarting failed container
  Warning  Unhealthy  2m39s (x83 over 106m)  kubelet, ip-172-30-29-144.ec2.internal  Liveness probe failed: Agent health: FAIL
=== 15 healthy components ===
ad-config-provider-docker, ad-dockerprovider, ad-kubeletlistener, ad-servicelistening, aggregator, collector-queue, dogstatsd-main, forwarder, healthcheck, jmxfetch, metadata-agent_checks, metadata-host, metadata-resources, tagger, tagger-docker
=== 1 unhealthy components ===
ad-config-provider-kubernetes
Error: found 1 unhealthy components

Describe what happened:

Everything has been working fine when using OnDemand with single instance type launch templates. Once we moved to mixed instance types utilizing Spot instances, one agent always seems to have issues, and gets stuck in a crash loop.

Describe what you expected:

Upon deploying a new spot instance, I imagine the DaemonSet would deploy a healthy pod.

Steps to reproduce the issue:

Scale up- new Daemon runs fine for ten minutes then gets put into a reboot loop.

Additional environment details (Operating System, Cloud provider, etc): EKS Kubernetes 1.13.7 Deploying to datadog-agent namespace Leader election via datadog-cluster-agent

Thanks!

kencieszykowski avatar Aug 15 '19 22:08 kencieszykowski

Hi @kencieszykowski

Thanks fo reporting! The issue seems to be located on this component ad-config-provider-kubernetes, not entirely sure why for now.

Could you share the logs of this pod as well?

Thanks

Simwar avatar Aug 16 '19 11:08 Simwar

@Simwar Most definitely. Here's the latest from the pod. Additionally I caught it for the few minutes it was running, and have attached the status as well. Strange thing is that this cluster currently has 17 nodes running, and this is the only pod that seems to be bugging out. Any help is appreciated!

crashloopbackoff.txt

ddagentstatus.txt

kencieszykowski avatar Aug 20 '19 22:08 kencieszykowski

Hi @kencieszykowski

It seems that the agent receives a SIGKILL:

2019-08-20 22:33:33 UTC | CORE | INFO | (cmd/agent/app/run.go:79 in func2) | Received signal 'terminated', shutting down...

and

2019-08-20 22:33:34 UTC | TRACE | INFO | (main.go:23 in handleSignal) | received signal 15 (terminated)

Your agent seems to run a lot of JMX checks. We have a lot of

2019-08-20 22:33:29,932 | WARN | Instance | Cannot get bean attributes The client has been closed.

In the logs as well. Which would mean that the agent cannot connect to the applications from which we get JMX metrics.

Does the agent OOM? You should be able to see this in the docker events, in the datadog event stream UI by looking for datadog and scoping only on the docker events. A SIGKILL is generally sent from Docker when the agent reaches its resources limits. Even though in this case, they seem to be high already.

Limits:
      cpu:     200m
      memory:  1Gi
    Requests:
      cpu:     200m
      memory:  512Mi

Maybe the CPU used goes outbound. You can check this by graphing the metric docker.cpu.usage over the container using the image datadog/agent and the correct hostname.

Simwar avatar Aug 21 '19 14:08 Simwar

@Simwar

Thank you for the guidance! For whatever reason, it didn't occur to me that all of the JMXFetch operations would push the CPU requests to the limit. The agents that were getting this error were on the nodes that housed most of our pods with JMX data. Increasing the upper limit for CPU seems to have stabilized everything and I'll close the issue.

Thanks again!

kencieszykowski avatar Aug 21 '19 21:08 kencieszykowski