Exercise

This exercise covers common application failure scenarios.

ImagePullBackOff Issues

  1. Create a Pod with an invalid image name, check the Pod status and describe it.
kubectl run broken-image --image=nginx:nonexistent-tag
  1. Fix the image reference using an existing image

CrashLoopBackOff Issues

  1. Create a Pod that exits immediately
kubectl run crash-pod --image=busybox --command -- /bin/sh -c "exit 1"
  1. Examine the logs and fix the Pod to keep it running

Documentation


Solution

ImagePullBackOff Issues

  1. Create a Pod with an invalid image name, check the Pod status and describe it.
  • creating the Pod
kubectl run broken-image --image=nginx:nonexistent-tag
  • checking the Pods status shows ImagePullBackOff
kubectl get pod broken-image
  • describing the Pod gives the origin of the error (image cannot be pulled)
kubectl describe pod broken-image
  1. Fix the image reference using an existing image
kubectl delete pod broken-image
kubectl run broken-image --image=nginx:latest

CrashLoopBackOff Issues

  1. Create a Pod that exits immediately

Command provided in the instructions

  1. Examine the logs and fix the Pod to keep it running
  • getting the Pod shows an CrashLoopBackOff error
kubectl get pods crash-pod
  • the logs don’t provide any information
kubectl logs crash-pod
  • describing the Pod shows the exit status 1
kubectl describe pod crash-pod
  • fixing the specification using another command
kubectl delete pod crash-pod
kubectl run crash-pod --image=busybox --command -- /bin/sh -c "while true; do sleep 30; done"