This article provides guidance on how to start a pod on a specific Kubernetes node using nodeSelector, nodeName in the pod manifest, and labeling nodes. It also explains how to use kubectl run with overrides to specify the desired node name for a pod.

k8s start pod at specific node

specify nodeSelector or nodeName in Pod or VirtualMachineInstance manifest

these selectors are in the spec field

1
2
kubectl run <pod name> --image=<image name> -it --rm --overrides='{"spec":{"nodeName": "<node name>"}}' -- /bin/sh

to label a node, run:

1
2
kubectl label node <node_name> <key>=<value>

Comments