Quiz Module 3 - Pods and Deployments
Instructions
This quiz contains 30 multiple-choice questions to validate your understanding of Module 3.
Tip: Answer each question before revealing the answer. The answers are hidden just after each question.
Question 1
What is a Pod in Kubernetes?
See explanation
Correct answer: The smallest deployable unit, containing one or more containers that share resources
Explanation: A Pod is a group of one or more containers that share the same IP address, network namespace, and volumes. It is the atomic unit of deployment in Kubernetes.
Question 2
What is the primary role of a ReplicaSet?
See explanation
Correct answer: Maintain a stable set of identical Pod replicas
Explanation: A ReplicaSet ensures that a specified number of identical Pods are always available. If a Pod crashes, the ReplicaSet automatically creates a new Pod.
Question 3
What is the main advantage of a Deployment over a ReplicaSet?
See explanation
Correct answer: It offers version management, rolling updates, and rollbacks
Explanation: Deployments manage ReplicaSets and offer advanced features like rolling updates (updates without downtime), rollbacks, and version management.
Question 4
What is the lifecycle of a Pod in Kubernetes?
See explanation
Correct answer: Pending → Running → Succeeded/Failed/Unknown
Explanation: A Pod goes through Pending (waiting for scheduling), then Running (execution), and can end in Succeeded (success), Failed (failure), or Unknown (unknown state).
Question 5
What is a Label in Kubernetes?
See explanation
Correct answer: A key-value pair attached to objects for organizing and selecting resources
Explanation: Labels are metadata in the form of key-value pairs that allow organizing, grouping, and selecting Kubernetes resources flexibly.
Question 6
What is the role of a Selector in Kubernetes?
See explanation
Correct answer: Identify a set of resources based on their Labels
Explanation: Selectors allow selecting resources (Pods, Services, etc.) based on their Labels, enabling ReplicaSets, Deployments, and Services to target the right Pods.
Question 7
What is the main difference between a ReplicaSet and a ReplicationController?
See explanation
Correct answer: ReplicaSet supports expression-based selectors (matchExpressions), ReplicationController does not
Explanation: ReplicaSet is the modern and improved version of ReplicationController, with more flexible selector support via matchExpressions.
Question 8
What deployment strategy is used by default in a Deployment?
See explanation
Correct answer: RollingUpdate
Explanation: RollingUpdate is the default strategy that updates Pods gradually, replacing old ones with new ones one by one or in small batches, ensuring service availability.
Question 9
What is a Liveness Probe?
See explanation
Correct answer: A probe that checks if the container is still alive and functioning correctly
Explanation: The Liveness Probe detects if a container is in a stuck or dead state. If the probe fails, Kubernetes restarts the container.
Question 10
What is a Readiness Probe?
See explanation
Correct answer: A probe that checks if the Pod is ready to receive traffic
Explanation: The Readiness Probe determines if a Pod is ready to receive requests. If the probe fails, the Pod is removed from the Service endpoints until it becomes ready again.
Question 11
What is a Startup Probe?
See explanation
Correct answer: A probe that checks if the application in the container has started
Explanation: The Startup Probe allows containers with long startup times to signal that they have started before other probes begin.
Question 12
What type of probe can be used for health checks?
See explanation
Correct answer: HTTP, TCP, or Exec
Explanation: Kubernetes supports three types of probes: HTTP (checks an HTTP response), TCP (checks if a port is open), and Exec (executes a command in the container).
Question 13
Which kubectl command allows you to see the deployment history?
See explanation
Correct answer: kubectl rollout history deployment/[name]
Explanation: This command displays the revision history of a Deployment, allowing you to see the different deployed versions and perform rollbacks if necessary.
Question 14
How do you rollback a Deployment to a previous version?
See explanation
Correct answer: kubectl rollout undo deployment/[name]
Explanation: This command undoes the last deployment and restores the previous version, allowing a quick rollback in case of issues.
Question 15
What is an Init Container?
See explanation
Correct answer: A container that runs before the main containers and must complete successfully
Explanation: Init Containers run sequentially before the main containers and are useful for configuration, waiting for dependencies, or preparing the environment.
Question 16
What is the difference between maxSurge and maxUnavailable in a RollingUpdate strategy?
See explanation
Correct answer: maxSurge defines the maximum number of additional Pods, maxUnavailable defines the maximum number of unavailable Pods
Explanation: maxSurge allows having more Pods than the desired number during the update, while maxUnavailable limits the number of Pods that can be unavailable simultaneously.
Question 17
What is a Pod Disruption Budget (PDB)?
See explanation
Correct answer: A policy that limits the number of Pods of an application that can be disrupted simultaneously
Explanation: A PDB ensures that a certain number of Pods of an application remain available during updates or maintenance, ensuring high availability.
Question 18
What is the advantage of using a Deployment rather than a Pod directly?
See explanation
Correct answer: Deployments offer version management, rolling updates, rollbacks, and automatic replication
Explanation: Deployments automatically manage ReplicaSets, offer advanced deployment and rollback features, which is not possible with direct Pods.
Question 19
What is the command to update a Deployment's image?
See explanation
Correct answer: kubectl set image deployment/[name] [container]=[new-image]
Explanation: This command updates a container's image in a Deployment, automatically triggering a rolling update.
Question 20
What does a ReplicaSet do if a Pod is manually deleted?
See explanation
Correct answer: It automatically creates a new Pod to maintain the desired number of replicas
Explanation: A ReplicaSet constantly monitors the number of Pods and automatically creates new Pods if the current number is below the desired number.
Question 21
What is the difference between a Pod and a container?
See explanation
Correct answer: A Pod can contain one or more containers that share network and storage resources
Explanation: A Pod is the atomic unit of deployment in Kubernetes and can contain multiple containers that share the same IP, network namespace, and volumes.
Question 22
What is a Static Pod?
See explanation
Correct answer: A Pod managed directly by kubelet on a specific node, without going through the API Server
Explanation: Static Pods are defined in a file on the node and are managed directly by kubelet, often used for Control Plane components.
Question 23
What is the Recreate deployment strategy?
See explanation
Correct answer: All old Pods are terminated before the new ones are created
Explanation: The Recreate strategy stops all existing Pods before creating new ones, causing a service interruption but ensuring only one version runs at a time.
Question 24
What is a DaemonSet?
See explanation
Correct answer: A workload that ensures a Pod runs on all (or some) nodes in the cluster
Explanation: A DaemonSet is used for system agents like logging or monitoring agents that need to run on every node.
Question 25
What is the default frequency of a Liveness Probe?
See explanation
Correct answer: Every 10 seconds
Explanation: By default, probes run every 10 seconds, but this value can be configured via the periodSeconds parameter.
Question 26
What is a Pod Preset (deprecated)?
See explanation
Correct answer: A resource that automatically injects information (env vars, volumes) into Pods matching certain selectors
Explanation: Pod Preset was a feature (now deprecated) that allowed automatic injection of ConfigMaps, Secrets, and volumes into Pods. Modern alternatives include Admission Controllers.
Question 27
Which command allows you to see the status of a rollout?
See explanation
Correct answer: kubectl rollout status deployment/[name]
Explanation: This command monitors the status of an ongoing rollout and waits for its completion, useful for knowing when an update is finished.
Question 28
What does a ReplicaSet do if the number of Pods exceeds the desired number?
See explanation
Correct answer: It deletes the excess Pods to return to the desired number
Explanation: A ReplicaSet always maintains the exact desired number of replicas, deleting excess Pods if necessary.
Question 29
What is the difference between a Deployment and a ReplicaSet?
See explanation
Correct answer: A Deployment manages ReplicaSets and offers deployment and rollback features
Explanation: A Deployment is a higher-level abstraction that manages ReplicaSets and offers advanced features like rolling updates and rollbacks.
Question 30
What can a Pod share with other containers in the same Pod?
See explanation
Correct answer: The IP address, network namespace, and volumes
Explanation: Containers in the same Pod share the same IP address, network namespace (can communicate via localhost), and mounted volumes.
Quiz Result
Congratulations on completing the Module 3 quiz!
Score:
- 25-30 correct answers: Excellent! You have mastered Pods and Deployments.
- 20-24 correct answers: Very good! Review the concepts where you had difficulties.
- 15-19 correct answers: Good! Review the chapters on Pods and Deployments.
- Less than 15: Recommended to review the module before continuing.
Next Steps
Now that you have validated your knowledge:
Module 4: Services and Networking
Practical Labs: Practice Pods and Deployments
Quiz created on: December 2024