Recall & Review
beginner
What is a node selector in Kubernetes?
A node selector is a simple way to tell Kubernetes to schedule a pod only on nodes that have specific labels. It helps control where pods run.
Click to reveal answer
beginner
How do you specify a node selector in a pod's YAML file?
You add a
nodeSelector field under spec with key-value pairs matching node labels. For example:<br>spec:
nodeSelector:
disktype: ssdClick to reveal answer
beginner
What happens if no nodes match the node selector labels?
The pod will stay in a pending state and will not be scheduled until a matching node becomes available.
Click to reveal answer
intermediate
Can a node selector use multiple labels?
Yes, you can specify multiple key-value pairs in
nodeSelector. The pod will only schedule on nodes that have all those labels.Click to reveal answer
beginner
How do you label a node in Kubernetes?
Use the command:
kubectl label nodes <node-name> key=value. This adds a label to the node that can be matched by node selectors.Click to reveal answer
What does a node selector do in Kubernetes?
✗ Incorrect
A node selector restricts pod scheduling to nodes with specific labels.
Where do you specify the node selector in a pod YAML file?
✗ Incorrect
The node selector is specified under the pod's spec.nodeSelector field.
What happens if no nodes match the node selector labels?
✗ Incorrect
If no nodes match, the pod remains pending until a suitable node is available.
How do you add a label to a node?
✗ Incorrect
The correct command to label a node is kubectl label nodes key=value.
Can a node selector require multiple labels?
✗ Incorrect
A node selector can specify multiple labels, and all must match on the node.
Explain how node selectors control pod scheduling in Kubernetes.
Think about how pods find the right nodes to run on.
You got /5 concepts.
Describe the steps to label a node and use that label to schedule a pod.
Start from labeling the node, then tell the pod to use that label.
You got /4 concepts.