Cloud and Container Basics

In Kubernetes, a Deployment with replicas: 3 is running three Pods. Which of the following correctly describes what happens when one of these Pods is deleted with kubectl delete pod?

  1. AThe Deployment's setting is also rewritten to replicas: 2, and two Pods keep running
  2. BA controller detects that the actual number has fallen below the specified 3 and creates one new Pod
  3. CThe other two Pods of the Deployment are also deleted, and the whole Deployment stops
Show answer and explanation

Answer: B. A controller detects that the actual number has fallen below the specified 3 and creates one new Pod

In Kubernetes, users declare a desired state such as "run three Pods", and controllers repeatedly observe the actual state and act to bring it closer to the declaration when they differ (reconciliation). Deleting one Pod makes the actual number 2, so the ReplicaSet controller creates a new Pod to return to 3. When a Pod is lost because a node fails, the same mechanism recreates it on another node. To really reduce the number of Pods, change the Deployment's replicas instead of deleting Pods.

  • A. Deleting a Pod does not change the replicas declared in the Deployment. Pods are created to close the gap with the declaration.
  • B. Correct. The controller closes the gap between the declared state and the actual state.
  • C. Only the deleted Pod is affected. Unless the Deployment is deleted, the other Pods keep running.
Practice this topic Back to topic

Books on Cloud and Container Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Cloud and Container Basics questions

  1. In a Kubernetes Deployment, the container image in the Pod template is changed to a new version. Which of the following correctly describes what happens with the default update strategy (RollingUpdate)?
  2. A Deployment with replicas: 10 has the rolling update settings maxSurge: 25% and maxUnavailable: 25%. Which of the following correctly gives the upper limit of the total number of Pods and the lower limit of the number of available Pods during an update?
  3. In Kubernetes, a Pod gets a different IP address every time it is recreated. Which of the following resources lets other applications connect, through a name and address that do not change, to several Pods selected by labels, with the load spread across them?
  4. In a Kubernetes cluster, HTTPS requests arriving for one host name should be routed to the api Service if the path begins with /api, and to the web Service otherwise. Which of the following resources is suitable for defining this routing rule?
  5. A database password is stored in a Kubernetes Secret. Which of the following correctly describes a Secret?