KCNA Container Orchestration 2 — Questions and Answers
Question 1: Which Kubernetes object is responsible for maintaining a stable set of replica Pods running at any given time?
- StatefulSet
- ReplicaSet (Correct answer)
- DaemonSet
- Deployment
Correct answer: ReplicaSet
A ReplicaSet ensures that a specified number of Pod replicas are running at all times.
Question 2: What happens to Pods managed by a DaemonSet when a new node is added to the cluster?
- A Pod is automatically scheduled on the new node (Correct answer)
- The DaemonSet must be manually updated
- Kubernetes ignores the new node until the next sync
- A new DaemonSet is created for the node
Correct answer: A Pod is automatically scheduled on the new node
DaemonSets automatically schedule one Pod on every eligible node, including newly added ones.
Question 3: In Kubernetes, which scheduling concept allows you to attract Pods to specific nodes based on node labels?
- Taints
- Tolerations
- Node Affinity (Correct answer)
- Pod Disruption Budget
Correct answer: Node Affinity
Node Affinity rules allow Pods to express preferences or requirements for scheduling on nodes with certain labels.
Question 4: What is the purpose of a Kubernetes Horizontal Pod Autoscaler (HPA)?
- Scales nodes up/down based on CPU
- Adjusts the number of Pod replicas based on observed metrics (Correct answer)
- Moves Pods between nodes to balance load
- Increases container resource limits dynamically
Correct answer: Adjusts the number of Pod replicas based on observed metrics
HPA automatically scales the number of Pod replicas in a workload based on CPU, memory, or custom metrics.
Question 5: Which field in a Pod spec defines the minimum and maximum CPU/memory resources a container can use?
- resourceQuota
- limitRange
- resources (requests and limits) (Correct answer)
- allocations
Correct answer: resources (requests and limits)
The `resources` field with `requests` and `limits` sub-fields controls resource allocation per container.
Question 6: What is the role of the kube-scheduler in Kubernetes?
- Maintains the desired state of cluster resources
- Assigns newly created Pods to nodes (Correct answer)
- Manages container runtime lifecycle
- Exposes the Kubernetes API
Correct answer: Assigns newly created Pods to nodes
The kube-scheduler watches for new unscheduled Pods and selects the best node for them to run on.
Question 7: A Pod has `restartPolicy: OnFailure`. What happens if the container exits with code 0?
- The container is restarted immediately
- The Pod is deleted
- The container is not restarted (Correct answer)
- The Pod enters CrashLoopBackOff
Correct answer: The container is not restarted
With `OnFailure`, containers are only restarted if they exit with a non-zero exit code; code 0 means success.
Which Kubernetes object is responsible for maintaining a stable set of replica Pods running at any given time?