A Pod is stuck in Init:0/1. The init container is named wait-for-db. Which command shows why?
- A.
kubectl logs mypod - B.
kubectl top pod mypod - C.
kubectl port-forward mypod 8080 - D.
kubectl logs mypod -c wait-for-db
Show answer and explanation
Answer: D
Init container output is read with -c <init-container-name>. Use kubectl describe pod mypod for events too.
- Without
-c, the main containers have not started, so no logs exist. topshows resource usage only.- Port forwarding needs a running application container.