January 2019
Intermediate to advanced
484 pages
11h 48m
English
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: ...
Read now
Unlock full access