Search⌘ K

Troubleshooting Issues in Pods

Understand how to troubleshoot errors in pods.

Troubleshooting errors in pods involves identifying issues and resolving them, using various commands like kubectl describe pod <pod_name> for details, and kubectl logs <pod-name> for the logs. We’ll be examining some common pod errors and resolving them.

The ErrImagePull error

This error occurs when a pod is unable to pull the specified container image from the container registry. It might be due to an incorrect image_name entry, authentication issues, or images not being available. We illustrate it below with the pod.yaml file.

YAML
apiVersion: v1
kind: Pod
metadata:
name: pod
spec:
containers:
- name: pod
image: ngin:latest

We apply the pod.yaml file above to create the pod and view the pod status below.

Shell
# To create the pod
kubectl apply -f pod.yaml
# To get the status of our pod
kubectl get pods
# To get the logs of our pod
kubectl logs <pod_name>
# To describe the pod for detailed issue
kubectl describe pod <pod_name>

When we check our logs using the kubectl logs <pod_name>, we get the following below.

"pod" in pod "pod" is waiting to start: trying and failing to pull image

When we also use the kubectl describe pod <pod_name> command, we get an ErrImagePull error. From our pod.yaml file, we can observe that our image was spelled wrongly because we used ngin ...