A node selector restricts a Pod to nodes with specified labels. Use `spec.nodeSelector` when a workload needs a capability such as fast disk access or a GPU. The scheduler looks for a matching node; if none exists, the Pod cannot be scheduled. section 3.2.7
To place and check a workload:
- Label an eligible node, for example with `kubectl label node <node-name> disk=fast`. section 3.4.1
- Set `spec.nodeSelector` to `disk: fast` in the Pod or deployment template. section 3.4.1 section 3.2.7
- Run `kubectl get pods -o wide` and check the NODE column against the labeled nodes. section 3.4.1
apiVersion: v1 kind: Pod metadata: labels: run: nginx-fast name: nginx-fast spec: containers: - image: nginx name: nginx-fast restartPolicy: Always nodeSelector: disk: fast
This Pod manifest shows the selector at `spec.nodeSelector`, matching the node label `disk=fast`. section 3.4.1
A label attracts a matching workload but does not keep other workloads off the node. For a GPU node reserved from workloads without permission to run there, pair the label and node selector with a taint and a matching Pod toleration. Selecting one node by its hostname is possible, but leaves no matching alternative if that node is unavailable. section 3.2.7 section 3.4.1
Node selectors are one input to the default scheduler alongside node affinity and taints and tolerations. They constrain placement; they do not replace the scheduler. section 3.3.2



