Search⌘ K

Exploring the Existing Namespaces

Explore how to identify and manage the existing namespaces within a Kubernetes cluster. Understand the roles of default, kube-public, and kube-system namespaces, and learn how to use kubectl commands to interact with resources in these namespaces to organize and isolate cluster objects effectively.

Now that we know that our cluster has multiple namespaces, let’s explore them a bit.

Getting the existing namespaces

We can list all the namespaces through the kubectl get namespaces command. As with most other Kubernetes objects and resources, we can also use the shortcut ns instead of the full name.

Shell
kubectl get ns

The output is as follows:

Shell
NAME STATUS AGE
default Active 23m
kube-node-lease Active 23m
kube-public Active 23m
kube-system Active 23m

We can see that three namespaces were set up automatically when we created the cluster.

The default namespace

The default namespace is the one we’ve used throughout so far. If we do not specify otherwise, all the kubectl ...