DevOps Containerization & Kubernetes 2 — Questions and Answers
Question 1: What is a ConfigMap in Kubernetes?
- An object for storing non-sensitive configuration data as key-value pairs (Correct answer)
- An encrypted secrets store
- A network configuration object
- A storage volume definition
Correct answer: An object for storing non-sensitive configuration data as key-value pairs
ConfigMaps decouple configuration from container images, letting you inject environment variables or config files into Pods at runtime.
Question 2: What is the difference between a StatefulSet and a Deployment in Kubernetes?
- StatefulSets maintain stable Pod identities and ordered scaling, while Deployments treat Pods as interchangeable (Correct answer)
- StatefulSets are only for databases
- Deployments cannot be scaled
- StatefulSets do not support rolling updates
Correct answer: StatefulSets maintain stable Pod identities and ordered scaling, while Deployments treat Pods as interchangeable
StatefulSets are designed for stateful applications that need stable hostnames, persistent storage, and ordered Pod lifecycle management.
Question 3: What does a Kubernetes Ingress resource do?
- Routes external HTTP/HTTPS traffic to internal Services based on rules (Correct answer)
- Manages container image pulls
- Controls Pod-to-Pod network policies
- Provides persistent storage to Pods
Correct answer: Routes external HTTP/HTTPS traffic to internal Services based on rules
An Ingress exposes HTTP and HTTPS routes from outside the cluster, routing traffic to Services based on hostname and path rules.
Question 4: What is a DaemonSet in Kubernetes?
- Ensures a copy of a Pod runs on every (or selected) node in the cluster (Correct answer)
- A set of scheduled batch jobs
- A high-availability database controller
- A cluster-level autoscaler
Correct answer: Ensures a copy of a Pod runs on every (or selected) node in the cluster
DaemonSets are used for node-level agents like log collectors, monitoring agents, or CNI plugins that must run on every node.
Question 5: What is the function of the Kubernetes Horizontal Pod Autoscaler (HPA)?
- Automatically scales the number of Pod replicas based on CPU/memory metrics (Correct answer)
- Scales node sizes vertically
- Distributes Pods evenly across availability zones
- Manages cluster node provisioning
Correct answer: Automatically scales the number of Pod replicas based on CPU/memory metrics
HPA monitors metrics and adjusts the replica count of a Deployment or StatefulSet to match current demand automatically.
Question 6: What is a multi-stage Docker build used for?
- Reducing the final image size by discarding build tools in intermediate stages (Correct answer)
- Running multiple containers in one image
- Building images in parallel
- Caching base layers across projects
Correct answer: Reducing the final image size by discarding build tools in intermediate stages
Multi-stage builds use multiple FROM instructions; only the final stage is shipped, leaving behind compilers and test tools that bloat the image.
What is a ConfigMap in Kubernetes?