k8wiz
Playground

Fix a Pod stuck in CrashLoopBackOff

Beginner · Kubernetes · about 10 min

The api Pods start, exit, and restart with a growing back-off. That's CrashLoopBackOff: the kubelet keeps restarting a container that keeps failing.

Loading the playground...

About this scenario

The api Pods start, exit, and restart with a growing back-off. That's CrashLoopBackOff: the kubelet keeps restarting a container that keeps failing.

The cause is in the container's own output. Find it, then fix the configuration the Deployment reads.

Objectives

  1. Find the error in the logs
  2. Add DATABASE_URL to the api-config ConfigMap
  3. All api Pods are Ready with no restarts

What you'll practice

  • CrashLoopBackOff means the container started and then exited, over and over. The reason is usually in its logs.
  • kubectl logs --previous shows the output of the last crashed run when the current one hasn't logged anything yet.
  • Changing a ConfigMap doesn't change environment variables in running Pods. A rollout restart does.

How the playground works

The cluster runs entirely in your browser: a simulated API server, scheduler, kubelets and controllers, with virtual nodes in three zones. kubectl output follows the real formats, errors use the real messages, and the add-ons (CSI storage, Traefik, Envoy Gateway, cert-manager, Flux, Argo CD) behave like their real counterparts for the common paths. It's a simulation, so some behavior is simplified. Your progress is saved in this browser.