kubectl: Mention namespace in "pods not found" error message
Hi, I’m a newish user. Recently I had the following situation:
- I ran
kubectl get pods -n my-namespace
and saw a crashed pod. - I copied the name of the pod and ran
kubectl logs my-pod-name
. It returnedError from server (NotFound): pods "my-pod-name" not found
- For some time, I really couldn’t understand why. Ran
get pods
again. The pod is right there! - A colleague pointed out that I needed to run
kubectl logs my-pod-name -n my-namespace
.
I understand the concept of namespaces. I’ve already encountered and used them before. But still, I made this mistake and couldn’t figure it out.
Please mention the namespace in the error message:
Error from server (NotFound): pods "my-pod-name" not found in namespace "default"
This should probably be done for all commands that operate on namespaced entities.
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 17 (13 by maintainers)
If this message comes from kubectl rather than client-go or cli-runtime, I think request is reasonable.
/transfer kubectl