Kubectl: Get Pods on Node

A Pod is a group of one or more containers with shared storage, network and lifecycle and is the basic deployable unit in Kubernetes.

Each Pod is scheduled on the same Node, and remains there until termination or deletion.

In this note i will show how to get Pods running on a specific Node using the kubectl command.

Cool Tip: Switch context in Kubernetes cluster! Read more →

Get Pods on Node using Kubectl

Get a list of all Nodes in Kubernetes:

$ kubectl get nodes
$ kubectl get nodes -o wide
Option Description
-o wide, --output wide Set output format to “wide”

To get Pods running on a specific Node in the default Namespace for the current context:

$ kubectl get pods --field-selector spec.nodeName=<node_name>
$ kubectl get pods --field-selector spec.nodeName=<node_name> -o wide

To list all Pods running on a specific Node in the all Namespaces:

$ kubectl get pods --field-selector spec.nodeName=<node_name> --all-namespaces
$ kubectl get pods --field-selector spec.nodeName=<node_name> --all-namespaces -o wide

Cool Tip: List & Change Namespaces in Kubernetes! Read more →

Was it useful? Share this post with the world!

Leave a Reply