Viewing Pods in Namespaces

Use the kubectl command view pods in a namespace in a Kubernetes cluster.

Namespaces can be used to further separate resource usage and to provide limited environments for particular use cases. By default, Kubernetes configures a namespace for Kubernetes system components and a standard namespace called default for all other deployments for which no namespace is defined.

To view existing namespaces, use the kubectl get namespaces and kubectl describe namespaces commands.

The kubectl command only displays resources in the default namespace, unless you specify a different namespace. For example, to view the pods specific to the Kubernetes system, use the --namespace option to set the namespace to kube-system:

kubectl get pods --namespace kube-system

The output looks similar to:

NAME                                           READY   STATUS    RESTARTS   AGE
coredns-f7d444b54-bw446                        1/1     Running   0          63m
coredns-f7d444b54-tsx8v                        1/1     Running   0          63m
etcd-ocne-control-plane-1                      1/1     Running   0          63m
kube-apiserver-ocne-control-plane-1            1/1     Running   0          63m
kube-controller-manager-ocne-control-plane-1   1/1     Running   0          63m
kube-proxy-ksl7l                               1/1     Running   0          63m
kube-proxy-lzdmr                               1/1     Running   0          62m
kube-proxy-t942q                               1/1     Running   0          62m
kube-scheduler-ocne-control-plane-1            1/1     Running   0          63m