How to view all namespaces in k8s?

To view all namespaces in Kubernetes, you can use the following command:

kubectl get namespaces

This command will return a list of all namespaces in the current cluster. An example output is shown below:

NAME              STATUS   AGE

default           Active   2d

kube-node-lease   Active   2d

kube-public       Active   2d

kube-system       Active   2d

The `NAME` column displays the name of the namespace, the `STATUS` column displays the status of the namespace (typically “Active”), and the `AGE` column shows the creation time of the namespace.

Before running the above command, please ensure that kubectl’s configuration is set up correctly and that you have sufficient permissions to view namespace information.

bannerAds