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:
https://digitalthoughtdisruption.com/2020/10/05/how-to-switch-between-namespaces-in-kubernetes/
https://digitalthoughtdisruption.com/2020/10/02/kubernetes-create-namespace-with-default-quotas/
https://digitalthoughtdisruption.com/2020/10/01/kubernetes-create-new-namespace-with-quotas/
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>
Summary:
Once again, really that easy. As always, I hope y’all found this helpful.