Deploying a Pod to a Node with a Label in Kubernetes

Get All Node Labels

Run a command to get all labels for all cluster nodes

kubectl get no --show-labels

We can also run this to show nodes by label

Create and Apply the Pod YAML

Create a file named pod.yaml and ensure that it has specified the node with the label disk=ssd

pod.yaml

Apply the YAML to your Kubernetes cluster

Verify The pod is Running on the Correct Node

Run a command that will show the pods and their associated nodes

Last updated