Read the signals of two failing pods

  • 12 min
  • 6 steps
  • Pods and workloads

Steps

0 of 6 done

Two pods restart in a loop for different reasons. Tell phase from status, read the previous run's logs and the last exit code, then replace the pod you can fix.

  1. Step 1 of 6

    kubectl get pods shows api in CrashLoopBackOff. Print the pod's actual phase.

    Checked against what your commands print.

  2. Step 2, not started: Read the output of the api container's last crashed run and find what it is missing.

  3. Step 3, not started: The thumbs pod restarts too. Find the reason and the exit code of its last terminated run.

  4. Step 4, not started: Environment variables cannot be changed on a running pod. Remove the api pod so you can create a corrected one.

  5. Step 5, not started: Create a pod named api from the image ghcr.io/kx-labs/ledger:1.0 with LEDGER_DB set to postgres://ledger-db:5432/ledger, and wait until it is ready.

  6. Step 6, not started: Print only the status of the Ready condition of the recreated api pod.

Lab terminal

Cluster time 1 minute 30 seconds
kind cluster kx, Kubernetes 1.37.
Each step is checked as you work.
​
Tab completes. Up and Down recall.
Type help for more.
Terminal keys

Enter runs the command. Tab completes, and the arrow keys recall earlier commands. Control C stops a watch. On an empty line, or after Escape, Tab moves focus out of the terminal.