Mastering Node Selection In Kubernetes With Nodeselector, Nodename, And Kubectl Run
Kubernetes
Pods
NodeSelectors
NodeNames
Labels
kubectl
Overrides
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
kubectl run <pod name> --image=<image name> -it --rm --overrides='{"spec":{"nodeName": "<node name>"}}' -- /bin/sh
to label a node, run:
kubectl label node <node_name> <key>=<value>