Kubernetes
medium

Pregunta de Kubernetes #019e3a4f

Enunciado de la Pregunta
Kubernetes
#deployment
#replicaset
#kubernetes
#pod
#controller
Medio

What is the difference between a Deployment and a ReplicaSet?

A

With a Deployment, you can’t control the number of pod replicas.

B

A ReplicaSet does not guarantee a stable set of replica pods running.

C

A Deployment is basically the same as a ReplicaSet with annotations.

D

A Deployment is a higher-level concept that manages ReplicaSets.

Correcto

Explicación Oficial / Explicaciones de la Comunidad

A Deployment is a higher-level Kubernetes resource that manages ReplicaSets. It provides declarative updates for Pods and ReplicaSets, enabling features like rolling updates, rollbacks, and scaling. A ReplicaSet ensures that a specified number of pod replicas are running at any given time, but it does not support rolling updates or rollbacks on its own. Deployments create and manage ReplicaSets, allowing for controlled updates and easy rollback to previous versions.

How it Works:

  • A Deployment controller watches for changes to the Deployment object and creates or updates a ReplicaSet to match the desired state.
  • When you update a Deployment (e.g., change the container image), it creates a new ReplicaSet and gradually scales down the old one while scaling up the new one, ensuring zero downtime.
  • ReplicaSets are responsible for maintaining a stable set of replica Pods. They use a label selector to identify which Pods to manage.
  • Deployments add an additional layer of abstraction, allowing you to manage the lifecycle of ReplicaSets and Pods declaratively.

Why the correct answer is right:

  • The statement "A Deployment is a higher-level concept that manages ReplicaSets" is correct because Deployments orchestrate ReplicaSets to provide advanced deployment strategies.

Why the incorrect answers are wrong:

  • The claim that "With a Deployment, you can’t control the number of pod replicas" is false. Deployments allow you to specify the desired number of replicas via the replicas field in the spec.
  • The statement "A ReplicaSet does not guarantee a stable set of replica pods running" is incorrect. The primary purpose of a ReplicaSet is to ensure that a specified number of pod replicas are running at all times.
  • The assertion that "A Deployment is basically the same as a ReplicaSet with annotations" is false. Deployments are a separate resource type that manage ReplicaSets and provide additional functionality beyond what ReplicaSets offer.