DevOps Kubernetes & Orchestration 2 — Questions and Answers
Question 1: What is a Kubernetes Namespace used for?
- Dividing cluster resources between multiple users or teams (Correct answer)
- Grouping nodes by geographic region
- Defining network policies between Pods
- Setting resource limits for individual containers
Correct answer: Dividing cluster resources between multiple users or teams
Namespaces provide a mechanism for isolating groups of resources within a single cluster, commonly used to separate environments like dev, staging, and production.
Question 2: What does a Kubernetes HorizontalPodAutoscaler (HPA) do?
- Automatically scales the number of Pods based on CPU or custom metrics (Correct answer)
- Scales node count in the underlying infrastructure
- Vertically scales container resource requests and limits
- Balances load evenly across all cluster nodes
Correct answer: Automatically scales the number of Pods based on CPU or custom metrics
The HPA controller periodically checks metrics and adjusts the replica count of a Deployment or ReplicaSet to meet the target utilization threshold.
Question 3: What is the purpose of a Kubernetes Ingress resource?
- Manages external HTTP/HTTPS access to services within the cluster (Correct answer)
- Provides persistent storage for containerized applications
- Stores sensitive data like passwords and API keys
- Defines resource quotas for namespaces
Correct answer: Manages external HTTP/HTTPS access to services within the cluster
An Ingress resource defines rules for routing external HTTP/HTTPS traffic to internal Services based on hostnames and URL paths.
Question 4: What is etcd in a Kubernetes cluster?
- A distributed key-value store that holds all cluster state and configuration (Correct answer)
- A container runtime for running Pods
- A load balancer for distributing traffic between Pods
- A monitoring tool for tracking cluster resource usage
Correct answer: A distributed key-value store that holds all cluster state and configuration
etcd is the backing store for all Kubernetes cluster data — every object, configuration, and state change is persisted in etcd.
Question 5: What is a Kubernetes DaemonSet?
- Ensures a copy of a Pod runs on every (or selected) node in the cluster (Correct answer)
- Runs a one-time batch job to completion
- Manages stateful applications with persistent storage
- Schedules Pods based on time-based triggers
Correct answer: Ensures a copy of a Pod runs on every (or selected) node in the cluster
A DaemonSet ensures that all or selected nodes run a copy of a Pod, commonly used for cluster-wide services like log collectors, monitoring agents, or network plugins.
Question 6: What does `kubectl rollout undo deployment/myapp` do?
- Rolls back the Deployment to its previous revision (Correct answer)
- Deletes the current Deployment and recreates it
- Pauses the rollout of the current Deployment
- Scales the Deployment down to zero replicas
Correct answer: Rolls back the Deployment to its previous revision
`kubectl rollout undo` reverts a Deployment to the previous ReplicaSet revision, useful for quickly recovering from a bad update.
What is a Kubernetes Namespace used for?