Kubernetes Container Orchestration Container Orchestration 4 — Questions and Answers
Question 1: Which Kubernetes object is used to store non-sensitive configuration data as key-value pairs?
- Secret
- ConfigMap (Correct answer)
- PersistentVolume
- ResourceQuota
Correct answer: ConfigMap
ConfigMaps decouple configuration artifacts from container images, making applications more portable.
Question 2: What is the difference between 'kubectl apply' and 'kubectl create'?
- 'apply' is faster; 'create' validates YAML first
- 'apply' is declarative and can update existing resources; 'create' fails if the resource already exists (Correct answer)
- 'create' supports all resource types; 'apply' only works with Deployments
- There is no functional difference between them
Correct answer: 'apply' is declarative and can update existing resources; 'create' fails if the resource already exists
'kubectl apply' performs a three-way merge to create or update resources, while 'create' is imperative and errors on existing resources.
Question 3: What is a Pod Disruption Budget (PDB) used for?
- Limiting the CPU usage of a Pod during disruptions
- Ensuring a minimum number of Pods remain available during voluntary disruptions (Correct answer)
- Automatically deleting Pods that exceed resource limits
- Scheduling maintenance windows for node upgrades
Correct answer: Ensuring a minimum number of Pods remain available during voluntary disruptions
A PDB protects applications from having too many Pods taken down simultaneously during operations like node drains.
Question 4: Which probe type in Kubernetes is used to determine if a container is ready to accept traffic?
- livenessProbe
- startupProbe
- readinessProbe (Correct answer)
- healthProbe
Correct answer: readinessProbe
A readinessProbe signals to Kubernetes when a container is ready, preventing traffic from being sent until it passes.
Question 5: What is the etcd component responsible for in a Kubernetes cluster?
- Running containers on worker nodes
- Storing all cluster state and configuration as a distributed key-value store (Correct answer)
- Routing network traffic between Pods
- Managing TLS certificates for the API server
Correct answer: Storing all cluster state and configuration as a distributed key-value store
etcd is the backing store for all Kubernetes cluster data, making its reliability critical to cluster operation.
Question 6: A Horizontal Pod Autoscaler (HPA) scales based on which metric by default?
- Memory usage
- Network I/O
- CPU utilization (Correct answer)
- Number of pending requests
Correct answer: CPU utilization
By default, HPA scales the number of Pod replicas based on observed CPU utilization against a target percentage.
Question 7: Which command safely evicts all Pods from a node before maintenance?
- kubectl delete node <name>
- kubectl cordon <node-name>
- kubectl drain <node-name> (Correct answer)
- kubectl taint node <name> NoSchedule
Correct answer: kubectl drain <node-name>
kubectl drain cordons the node and evicts all Pods respecting PodDisruptionBudgets, preparing it for maintenance.
Which Kubernetes object is used to store non-sensitive configuration data as key-value pairs?