KCNA · Question #65
What does the "nodeSelector" within a PodSpec use to place Pods on the target nodes?
The correct answer is D. Labels. The nodeSelector field in a PodSpec uses node labels to constrain which nodes a Pod is eligible to be scheduled on.
Question
What does the "nodeSelector" within a PodSpec use to place Pods on the target nodes?
Options
- AAnnotations
- BIP Addresses
- CHostnames
- DLabels
How the community answered
(29 responses)- A3% (1)
- B3% (1)
- D93% (27)
Why each option
The `nodeSelector` field in a PodSpec uses node labels to constrain which nodes a Pod is eligible to be scheduled on.
Annotations are used for non-identifying metadata and do not influence Pod scheduling decisions like `nodeSelector` does.
While nodes have IP addresses, `nodeSelector` does not directly use IP addresses for scheduling; it relies on labels for declarative node selection.
Hostnames are identifiers for nodes, but `nodeSelector` operates on arbitrary key-value labels, offering more flexible and generic selection than just hostnames.
The `nodeSelector` field in a PodSpec takes a map of key-value pairs, which are then matched against the labels assigned to nodes. Only nodes that possess all the specified labels will be considered for scheduling the Pod.
Concept tested: Kubernetes Pod scheduling with nodeSelector
Source: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector
Topics
Community Discussion
No community discussion yet for this question.