6

Kubectl: Get Pods on Node

 2 years ago
source link: https://www.shellhacks.com/kubectl-get-pods-on-node/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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 →

Leave a Reply Cancel reply


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK