The node selector of a pod is the most intuitive way to place pods manually. It's similar to the pod selectors of the service object but instead for choosing nodes—that is, a pod would only be put on nodes with matching labels. The corresponding label key-value map is set at the .spec.nodeSelector of a pod's manifest in the following form:
...
spec:
nodeSelector:
<node_label_key>: <label_value>
...
It's possible to assign multiple key-value pairs in a selector, and Kubernetes will find eligible nodes for the pod with the intersection of those key-value pairs. For instance, the following snippet of a spec pod tells Kubernetes we want the pod to be on nodes with the purpose=sandbox and owner=alpha labels:
...
spec:
containers:
- name: main
image: my-app
nodeSelector:
purpose: sandbox
owner: alpha
...
If Kubernetes can't find a node with such label pairs, the pod won't be scheduled and will be marked as in the Pending state. Moreover, since nodeSelector is a map, we can't assign two identical keys in a selector, otherwise the value of the keys that appeared previously will be overwritten by later ones.