How to List All Namespaces in a Cluster?

I am trying to figure out how to list all namespaces in a cluster:

something like:

kubectl describe cluster --namepaces -o json

anyone know how to list all the namespaces in a K8S/EKS cluster?

2 Answers

Additionally, (to the other answer), this is a short way:

$ kubectl get ns
$ kubectl describe ns

Also, you can use kubens to list and switch namespaces (on your local KUBECONFIG)

 $ kubens

Namespaces are an object like any other, so kubectl get namespaces will list them. kubectl describe namespaces will print full details.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest