KCNA Scheduling and Scaling 3 — Questions and Answers
Question 1: What is the purpose of the `topologySpreadConstraints` field in a Pod spec?
- To distribute pods evenly across failure domains such as zones or nodes (Correct answer)
- To limit the number of pods per namespace
- To define network topology for service mesh routing
- To constrain which container runtimes a pod may use
Correct answer: To distribute pods evenly across failure domains such as zones or nodes
`topologySpreadConstraints` lets you control how pods are spread across topology domains to improve availability and balance.
Question 2: Which HPA metric type allows scaling based on a metric exposed by an external system outside the cluster?
- External (Correct answer)
- Object
- Pods
- Resource
Correct answer: External
The `External` metric type in HPA enables scaling based on metrics from systems outside the Kubernetes cluster, such as a cloud queue depth.
Question 3: A pod with `requiredDuringSchedulingIgnoredDuringExecution` node affinity cannot be scheduled if the rule is not satisfied. What happens to the pod?
- It stays Pending until a matching node becomes available (Correct answer)
- It is scheduled on any available node as a fallback
- It fails immediately with an error and is deleted
- It is rescheduled on a node with the closest matching labels
Correct answer: It stays Pending until a matching node becomes available
Hard affinity rules (`required...`) cause the pod to remain Pending indefinitely if no node satisfies the constraint.
Question 4: What does the Cluster Autoscaler do when a node has been underutilized for the scale-down delay period?
- Terminates the node and reschedules its pods elsewhere (Correct answer)
- Cordons the node and waits for an operator to drain it
- Reduces the node's CPU allocation without removing it
- Marks the node as unschedulable but keeps it running
Correct answer: Terminates the node and reschedules its pods elsewhere
Cluster Autoscaler removes underutilized nodes from the node group and reschedules the pods that were running on them.
Question 5: Which kubectl command removes a taint from a node?
- kubectl taint nodes <node> key=value:Effect- (Correct answer)
- kubectl taint nodes <node> key=value:Effect --remove
- kubectl label nodes <node> key-
- kubectl annotate nodes <node> taint-
Correct answer: kubectl taint nodes <node> key=value:Effect-
Appending a `-` at the end of the taint specification in `kubectl taint nodes` removes that taint from the node.
Question 6: When using pod affinity with `preferredDuringSchedulingIgnoredDuringExecution`, what happens if no node satisfies the preference?
- The pod is scheduled on the best available node without the preference being met (Correct answer)
- The pod remains Pending until a matching node is available
- The pod is rejected with a scheduling error
- The scheduler retries indefinitely until a matching node registers
Correct answer: The pod is scheduled on the best available node without the preference being met
Soft affinity (`preferred...`) is a hint, not a requirement; the scheduler places the pod even if the preference cannot be satisfied.
Question 7: Which KEDA concept defines the external event source that triggers pod scaling?
- ScaledObject
- TriggerAuthentication
- ScaledJob
- Scaler (Correct answer)
Correct answer: Scaler
In KEDA, a Scaler is the component that connects to an external source (like Kafka or Redis) and reports the current metric value used for scaling decisions.
What is the purpose of the `topologySpreadConstraints` field in a Pod spec?