Goal
The orders-api Deployment in namespace shop is stuck in CrashLoopBackOff. Find out why from the logs, and get both replicas Running using the database credentials that already exist in the namespace. Do not paste the connection string into the Deployment.
How it is graded
- DATABASE_URL comes from Secret orders-db, key url30 pts
- Both orders-api pods are Running and ready30 pts
- Deployment reports 2 available replicas20 pts
- ?3 hidden checks, revealed when you grade. They make sure the fix keeps to the rules in the goal.
Your cluster
- 2 × worker 4 CPU · 16Gi
In production
kubectl logs --previousshows the output of the last crashed container, which is often where the real error is.- Restart back-off grows to 5 minutes, so after a fix watch
kubectl rollout statusinstead of waiting on the old pods. - Many teams sync credentials from a secret manager (for example with External Secrets or the Secrets Store CSI Driver) instead of creating Secrets by hand.