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

CrashLoopBackOff private GKE cluster

Open ghost opened this issue 6 years ago • 4 comments

Are there any special steps for a private GKE cluster?

My datadog agents are stuck in a crash loop on a private gke cluster with the following error:

failed to try resolving symlinks in path "/var/log/pods/monitoring_datadog-agent-4ghvg_be172128-a337-4a15-b73a-1ac1db9d5db0/datadog-agent/3.log": lstat /var/log/pods/monitoring_datadog-agent-4ghvg_be172128-a337-4a15-b73a-1ac1db9d5db0/datadog-agent/3.log: no such file or directory%    

Here is the agent manifest:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: datadog-agent
spec:
  selector:
    matchLabels:
      app: datadog-agent
  template:
    metadata:
      labels:
        app: datadog-agent
      name: datadog-agent
    spec:
      containers:
      - image: datadog/agent:latest
        imagePullPolicy: Always
        name: datadog-agent
        ports:
          - containerPort: 8125
            name: dogstatsdport
            protocol: UDP
          - containerPort: 8126
            name: traceport
            protocol: TCP
        env:
          - name: DD_API_KEY
            value: "removed"
          - name: DD_COLLECT_KUBERNETES_EVENTS
            value: "true"
          - name: DD_LEADER_ELECTION
            value: "true"
          - name: KUBERNETES
            value: "yes"
          - name: DD_KUBERNETES_KUBELET_HOST
            valueFrom:
              fieldRef:
                fieldPath: status.hostIP
          - name: DD_LOGS_ENABLED
            value: "true"
          - name: DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL
            value: "true"
          - name: DD_AC_EXCLUDE
            value: "name:datadog-agent"
        resources:
          requests:
            memory: "256Mi"
            cpu: "200m"
          limits:
            memory: "256Mi"
            cpu: "200m"
        volumeMounts:
          - name: dockersocket
            mountPath: /var/run/docker.sock
          - name: procdir
            mountPath: /host/proc
            readOnly: true
          - name: cgroups
            mountPath: /host/sys/fs/cgroup
            readOnly: true
          - name: pointerdir
            mountPath: /opt/datadog-agent/run
        livenessProbe:
          exec:
            command:
            - ./probe.sh
          initialDelaySeconds: 15
          periodSeconds: 5
      volumes:
      - hostPath:
          path: /var/run/docker.sock
        name: dockersocket
      - hostPath:
          path: /proc
        name: procdir
      - hostPath:
          path: /sys/fs/cgroup
        name: cgroups
      - hostPath:
          path: /opt/datadog-agent/run
        name: pointerdir

ghost avatar Dec 22 '19 19:12 ghost

@devkws It looks like the error pertains to the Kubernetes log file paths of /var/log/pods, so the agent will need access to these files to tail. There's a symlink between this directory and a Docker logs directory (/var/lib/docker/containers) so we need to mount the /var/log/pods path as well as /var/lib/docker/containers. There's a reference to this in our documentation here: https://docs.datadoghq.com/agent/kubernetes/daemonset_setup/?tab=k8sfile

If you need any additional troubleshooting help, please reach out to us!

DylanLovesCoffee avatar Jan 08 '20 15:01 DylanLovesCoffee

@DylanLovesCoffee Thank you, I see that now. Will give that a shot.

Its weird though, when you login and follow the DS instructions from the getting started, all the docs do not mention that directory. My yaml listed above is a copy and paste from those docs.

ghost avatar Jan 08 '20 15:01 ghost

are you able to get in contact as to how you overcame this??

SherazShahid17 avatar May 20 '20 19:05 SherazShahid17

@SherazShahid17 adding the volumes and volumemounts listed above worked and corrected the issue. I believe the documentation needs to be updated still to address this.

ghost avatar May 20 '20 21:05 ghost