How to debug why my pods are pending in GCE

2/28/2019

I'#m trying to get a pod running on GCE. The pod has an init container, and is created by me applying a manifest with a deployment that creates 1 replica of the pod.

When I look at my workloads on the cloud console, I can see that under 'Active revisions' my deployment is in the state of 'Pods are pending', and under 'Managed pods', the status is 'PodsInitializing'.

The container logs are empty, and the audit logs contain a single entry for the creation of the deployment.

My pods seem to be stuck in the above state, and I'm not really sure why. How do I go about debugging that?

Edit:

kubectl get pods --namespace=my-namespace

Outputs:

NAME                        READY     STATUS     RESTARTS   AGE
my-pod-v77jm                0/1       Init:0/1   0          55m

But when I run:

kubectl describe pod my-pod-v77jm

I get

Error from server (NotFound): pods "my-pod-v77jm" not found
-- Andy
google-cloud-platform
google-compute-engine
kubernetes

1 Answer

2/28/2019

If you have access to kube-api via kubectl:

Use describe see details about the pod and containers

kubectl describe myPod --namespace mynamespace

To view container logs (including init containers)

kubectl logs myPod --namespace mynamespace -c initContainerName

You can get more information about pod statuses and how to debug init containers here

-- Hazim
Source: StackOverflow