Two Pods are running: a website and the API behind it.
namespace shallows-1wc58hj
- market-webWebsite
- market-apiAPI
Both live in a : a named partition of the cluster. Every Pod belongs to exactly one. kubectl get pods on its own only looks in the namespace called default, so to see Pods anywhere else you add -n <namespace>.
Check on our Pods:
kubectl get pods -n shallows-1wc58hjOne Pod is Running. The other cycles between Error and CrashLoopBackOff, with a RESTARTS count that keeps climbing. That is a crash loop: the container starts, exits, and Kubernetes restarts it, waiting a little longer each time.
Read before you touch
Crash loops explain themselves, if you ask the right thing:
kubectl logs market-api -n shallows-1wc58hjThe API is complaining about something it needs and does not have. The second objective wants the name of that thing exactly as the log spells it.
describe adds the other half of the picture: the exit code, the Last State, and an Events timeline of every back-off:
kubectl describe pod market-api -n shallows-1wc58hjReplace, don't repair
The Pod is running the wrong image. stackmonsters/crasher is a placeholder someone forgot to swap out; the real API image is stackmonsters/monster-market-api, which already knows how to find its database.
A Pod's container image can be swapped in place, but it is cleaner, and more common in practice, to delete the broken Pod and create the right one:
kubectl delete pod market-api -n shallows-1wc58hj
kubectl run market-api --image=stackmonsters/monster-market-api -n shallows-1wc58hjThen confirm:
kubectl get pods -n shallows-1wc58hjBoth Pods Running, RESTARTS at zero.