Explore foundational concepts of Kubernetes, including Pods, Deployments, and Services, with this quiz designed to clarify how container orchestration works, key terminology, and basic configuration scenarios. Understand critical Kubernetes architecture and resource relationships for improved application management and scaling.
In Kubernetes, which object represents the smallest and simplest deployable unit that can be created or managed?
Explanation: A Pod is the smallest deployable unit in Kubernetes and can contain one or more containers. Deployments and Services manage or expose Pods but are not the smallest units. Nodes refer to the underlying infrastructure machines that host Pods, not the resources themselves.
Which statement correctly describes what a Kubernetes Pod can contain?
Explanation: Pods are designed to host one or more tightly coupled containers with shared storage and network. The single container option is too restrictive as Pods may have more. Deployments organize Pods, not deployments within a pod. Clusters are collections of nodes, not the contents of a Pod.
What is the primary role of a Deployment in Kubernetes?
Explanation: A Deployment helps automate the scaling, rollout, and rollback of Pods, ensuring desired state consistency. Network access is handled by different resources like NetworkPolicies or Services. Scheduling is done by the Scheduler, not Deployments. Hardware monitoring is not the main purpose of Deployments.
How does a Kubernetes Service typically benefit application Pods?
Explanation: A Service acts as a stable endpoint, directing network traffic to healthy Pods, even as Pods are added or removed. Storage allocation is not its function. Automatic deployment of databases is incorrect, and default encryption for all traffic is managed separately.
If a Deployment is configured with 5 replicas but only 3 Pods are running, what will Kubernetes do?
Explanation: Kubernetes will reconcile the difference and launch the missing Pods to reach the configured replica count. Terminating all Pods is incorrect and merging Pods isn't supported. Doing nothing is false, as Kubernetes automatically maintains the declared state.
What happens to the containers inside a Pod when the Pod is deleted?
Explanation: All containers within a Pod share the same lifecycle, so deleting the Pod stops them all. Containers can't run independently without the Pod. Stopping only the oldest is not supported, and automatic transfer of containers between Pods doesn't occur.
By default, what does a Kubernetes Service use to select the Pods it routes network traffic to?
Explanation: Services use label selectors to target and direct traffic to the appropriate Pods. Timestamps, image names, and resource allocation are not typically used for this selection process. Labels provide a flexible way to organize and connect resources.
Which statement accurately describes the network namespace of Pods in Kubernetes?
Explanation: Containers within a Pod share a network namespace and therefore have the same IP address. Each Pod, however, gets its own IP. Saying each container has its own IP is incorrect. Pods can communicate, and containers in different Pods do not share IP addresses.
Which Kubernetes Service type exposes an application on a static port that is accessible inside the cluster only?
Explanation: ClusterIP is set by default and exposes the service on an internal IP only, making it accessible within the cluster. NodePort exposes services externally on a node IP, LoadBalancer provisions external load balancers, and ExternalName maps services to DNS names.
What is a key feature of a Kubernetes Deployment when an update introduces an issue?
Explanation: Deployments can undo failed updates by rolling back to a previous ReplicaSet, restoring the prior working state. Logging errors is helpful but doesn't revert changes. Deleting clusters or disabling Pods in response to an issue would be extreme and is not standard behavior.