kuberneteskubernetes-podkubernetes-dashboard

Getting no pods error while checking the logs of a pod even the pod is up and running


I installed kubernetes dashboard by referring kubernetes.io, everything was fine (I edited the pod and replaced cluster-ip with Nodeport)

enter image description here

but the dashboard does not respond after some time of being logged in. Again I have to login using bearer token and again the cycle repeats after some time. when I checked the logs using kubectl logs podname it throws an error as no pods found by that name but if I pass kubectl get pods it shows as the pod is running and even I can able to access it.


Solution

  • You need to have namespacename using -n flag to the kubectl logs command. Without namespacename it looks for the pod in default namespace but your pod is in kubernetes-dashboard namespace.

    kubectl logs podname -n kubernetes-dashboard