How to search all namespaces in Kubernetes

Posted by

I wasn’t expecting to get so in-depth into namespaces but I had another question come up.  What if you have multiple namespaces in your environment and you wanted to see them all.  Also, what if you were trying to find a particular pod in an unknown namespace.

My previous namespace articles:

How to see all namespaces

$ kubectl get namespaces

Pretty easy one here and as you can see I have a lot of namespaces created.

Finding a particular pod in an unknown namespace – for this example we are looking for the pod named mysql

$ kubectl get pods –all-namespaces | findstr <pod>

$ kubectl get pods –all-namespaces | grep -I <pod>

Once again, really that easy.  As always, I hope y’all found this helpful.

Leave a Reply