Kubernetes Container Orchestration Scheduling and Scaling 5 — Questions and Answers
Question 1: Which HPA behavior field prevents rapid oscillation by limiting how quickly scale-down can occur?
- spec.scaleUp.stabilizationWindowSeconds
- spec.scaleDown.stabilizationWindowSeconds (Correct answer)
- spec.metrics[].resource.target.averageUtilization
- spec.minReplicas
Correct answer: spec.scaleDown.stabilizationWindowSeconds
The scaleDown stabilizationWindowSeconds (default 300s) makes HPA look back over the window and use the highest replica count seen to avoid thrashing.
Question 2: A pod is scheduled on a node, but the node's kubelet rejects it because the pod's resource requests exceed actual node capacity. What is the most likely cause?
- The scheduler scored the node incorrectly
- The node was overcommitted by setting --allow-metric-overcommit
- The node's allocatable capacity was not reflected in the API server cache at scheduling time (Correct answer)
- The pod used ephemeral storage limits above the node's disk size
Correct answer: The node's allocatable capacity was not reflected in the API server cache at scheduling time
Stale node capacity data in the scheduler's cache can cause it to assign a pod to a node that no longer has sufficient allocatable resources.
Question 3: What Kubernetes object can you use to run a batch job that scales the number of parallel workers based on work items remaining?
- Deployment with HPA
- StatefulSet
- Job with completions and parallelism (Correct answer)
- DaemonSet
Correct answer: Job with completions and parallelism
A Job's spec.completions and spec.parallelism fields control how many pods run in parallel to complete a fixed number of work items.
Question 4: Which label on a node is typically used as the topology key for zone-aware pod spreading in cloud environments?
- kubernetes.io/hostname
- topology.kubernetes.io/zone (Correct answer)
- node.kubernetes.io/instance-type
- beta.kubernetes.io/arch
Correct answer: topology.kubernetes.io/zone
Cloud providers set topology.kubernetes.io/zone on nodes, making it the standard key for zone-based topology spread constraints.
Question 5: You want only pods from a specific team's namespace to use high-performance nodes. Which combination achieves this with least privilege?
- Label nodes and use nodeSelector in every pod spec
- Taint the nodes and add tolerations only to the team's namespace service account
- Taint nodes and use a MutatingAdmissionWebhook to inject tolerations into pods in the team's namespace (Correct answer)
- Use ResourceQuota to restrict GPU usage to the team's namespace
Correct answer: Taint nodes and use a MutatingAdmissionWebhook to inject tolerations into pods in the team's namespace
A MutatingAdmissionWebhook can automatically inject tolerations into pods in specific namespaces, avoiding manual toleration configuration in every pod spec.
Question 6: What is the role of the `kube-scheduler` extender in the scheduling pipeline?
- It replaces the default scheduler with a custom binary
- It adds external filter and prioritize HTTP endpoints called by the default scheduler (Correct answer)
- It injects sidecars into pods before they are bound to nodes
- It implements custom resource definitions for new scheduling policies
Correct answer: It adds external filter and prioritize HTTP endpoints called by the default scheduler
Scheduler extenders are external HTTP services that the kube-scheduler calls during filter and score phases to apply custom logic without replacing the scheduler.
Question 7: When Cluster Autoscaler scales up, it provisions new nodes but pods remain Pending for several minutes. What is the most likely cause?
- The HPA has not yet updated the desired replica count
- Node provisioning and kubelet registration take time before the node is Ready (Correct answer)
- The scheduler is waiting for PodDisruptionBudget approval
- Cluster Autoscaler requires manual approval for each scale-up event
Correct answer: Node provisioning and kubelet registration take time before the node is Ready
Cloud node provisioning, OS boot, kubelet startup, and CNI plugin initialization typically take 2-5 minutes before a node becomes Ready and schedulable.
Which HPA behavior field prevents rapid oscillation by limiting how quickly scale-down can occur?