Stuck in PodInitializing

You may see a scenario where your pods appear to be hanging while initializing, especially when you are first setting up the configuration where it involves volume mounts and ConfigMaps. 

The status from kubectl get pods will look something like this:

NAME                          READY STATUS   RESTARTS AGEflask-6bc4b4c8dc-cm6gx        0/2   Init:0/1 0        7mredis-master-75c798658b-p4t7c 1/1   Running  0        7m

And the status doesn't change. Trying to get logs about what is happening, such as: 

kubectl logs flask-6bc4b4c8dc-cm6gx init-myservice

Results in this message:

Error from server (BadRequest): container "init-myservice" in pod "flask-6bc4b4c8dc-cm6gx" is waiting to start: PodInitializing

The best thing to do here is to use kubectl describe to get the detail ...

Get Kubernetes for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.