A simple solution for matching pod deployments to nodes
Set a label on a node:
# kubectl label nodes <node-name> key=val
kubectl label nodes this-node size=large
Set a nodeSelector in a pod def file to match the node label:
apiVersion: v1
kind: Pod
metadata:
name: pod
spec:
containers:
- name: horse
image: horse
# THIS matches the node label above
nodeSelector:
size: large
Useful For Simple Use-Cases
This Pod-to-Node label matching node-selector works for clear goals for deploying a specific pod to a specific node.
The pod gets a nodeSelector
and the node gets a label.
The pod with the nodeSelector will get deployed to the node with the matching label.
More Flexibility Comes With Node Affinity
See Node Affinity.