How to Debug Kubernetes Createcontainerconfigerror

How to Debug Kubernetes Createcontainerconfigerror

I'm trying to learn configuring Kubernetes and am currently studying configuring pods with configmaps.

I just created a simple pod with nginx, trying to link it to a configmap called options with the following yaml file:

apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    run: pod
  name: pod
spec:
  containers:
  - image: nginx
    name: pod
    resources: {}
    env:
      - name: options
        valueFrom:
          configMapKeyRef:
            name: option
            key: var5
  dnsPolicy: ClusterFirst
  restartPolicy: Always
status: {}

When looking at my pods, I see a CreateContainerConfigError error. My question is: How can you debug a pod that has a config error? I am not interested in what went wrong in this specific case, is it possible to, for example, go into the pod and see what was wrong?

1 Answer

Run kubectl describe pod <podname> -n <namespace>, you might see the cause of failing.

If pod not started then you can not exec into pod, In this case run kubectl get pods -o wide and check in which node the pod is scheduled. Go to that node and run docker ps -a and get the container id desired container. then check docker logs -f <container id>

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.