Skip to main content

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. Answers are hidden right 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, the same network namespace, and the same 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 number of identical Pod replicas

Explanation: A ReplicaSet guarantees that a specified number of identical Pods is 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 provides version management, rolling updates, and rollbacks

Explanation: Deployments manage ReplicaSets and provide advanced features like rolling updates (updates without interruption), 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 to be scheduled), then Running (executing), and can terminate as 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 to organize and select resources

Explanation: Labels are metadata in the form of key-value pairs that allow you to organize, group, and select 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 you to select 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​

Which deployment strategy is used by default in a Deployment?

See explanation

Correct answer: RollingUpdate

Explanation: RollingUpdate is the default strategy that progressively updates Pods, replacing old ones with new ones one by one or in small groups, 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 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 shows 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 versions deployed 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, enabling a quick rollback in case of problems.


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 simultaneously unavailable.


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 guarantees 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 provide version management, rolling updates, rollbacks, and automatic replication

Explanation: Deployments automatically manage ReplicaSets and provide advanced deployment and rollback features, which is not possible with direct Pods.


Question 19​

What is the command to update the image of a Deployment?

See explanation

Correct answer: kubectl set image deployment/[name] [container]=[new-image]

Explanation: This command updates the image of a container 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 less than 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, the same network namespace, and the same 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 new ones are created

Explanation: The Recreate strategy stops all existing Pods before creating new ones, causing a service interruption but guaranteeing that 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 certain) 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 automatically injecting ConfigMaps, Secrets, and volumes into Pods. Modern alternatives include Admission Controllers.


Question 27​

Which command shows 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 excess Pods to return to the desired number

Explanation: A ReplicaSet always maintains the exact desired number of replicas, deleting excess Pods when necessary.


Question 29​

What is the difference between a Deployment and a ReplicaSet?

See explanation

Correct answer: A Deployment manages ReplicaSets and provides deployment and rollback features

Explanation: A Deployment is a higher-level abstraction that manages ReplicaSets and provides 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, the network namespace, and the volumes

Explanation: Containers in the same Pod share the same IP address, the same network namespace (they can communicate via localhost), and the same mounted volumes.


Quiz Results​

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
Hands-on Labs: Put Pods and Deployments into practice


Quiz created: December 2024