Cannot debug pod Kubernetes

10/31/2019

I have setup the Kubernetes cluster in my cloud. When it setup complete I install kong-ingress-controller in my master node. I'm using:

kubectl apply -f https://bit.ly/ kong-ingress

Now my container status is still init. I want debug init container. So I used:

 kubectl get pods -o=name --all-namespaces | grep kong

Response:

pod/ingress-kong-6b6b4c4f5-lg6tp
pod/kong-migrations-grvph

Next I using command:

kubectl logs pod/ingress-kong-6b6b4c4f5-lg6tp -c init-container-name

But I get:

Error from server (NotFound): pods "ingress-kong-6b6b4c4f5-lg6tp" not found

I dont know why I get this error. Please help me. Thanks in advance

-- Akashii
kubernetes
kubernetes-ingress

1 Answer

10/31/2019

If you look at the raw file on that URL you will notice that the deployments and as a result pods are in namespace kong

  namespace: kong

The namespaces are used to logically isolate resources within a cluster and you can read more here

Now for your log command to work, you will have to add a namespace flag like this:

kubectl logs -n kong pod/ingress-kong-6b6b4c4f5-lg6tp -c init-container-name

Notice the -n kong in the logs command, and hopefully it should work

-- Vishal Biyani
Source: StackOverflow