Container Orchestration
medium

Pregunta de Container Orchestration #019e3a4f

Enunciado de la Pregunta
Container Orchestration
#kubernetes
#deployment
#scaling
#kubectl
Medio

What methods can you use to scale a deployment?

A

With kubectl edit deployment exclusively.

B

With kubectl scale-up deployment exclusively.

C

With kubectl scale deployment and kubectl edit deployment.

Correcto
D

With kubectl scale deployment exclusively.

Explicación Oficial / Explicaciones de la Comunidad

Summary

To scale a Kubernetes deployment, you can use either kubectl scale deployment or kubectl edit deployment. Both methods allow you to change the number of replicas, but they work differently.

How It Works

  • kubectl scale deployment: This command directly sets the desired number of replicas for a deployment. For example, kubectl scale deployment my-deployment --replicas=5 updates the replica count immediately.
  • kubectl edit deployment: This command opens the deployment's YAML manifest in an editor, allowing you to modify any field, including spec.replicas. After saving, the change is applied to the cluster.

Both commands modify the same underlying resource and are valid methods for scaling.

Why the Correct Answer is Right

The correct answer includes both kubectl scale deployment and kubectl edit deployment. Using kubectl scale is the most direct way to change replicas, while kubectl edit provides a more flexible approach for making multiple changes at once. Both are officially supported and commonly used.

Why the Incorrect Answers are Wrong

  • kubectl edit deployment exclusively: While kubectl edit can scale a deployment, it is not the only method. kubectl scale is a dedicated command for scaling and is often more efficient. Therefore, stating that scaling can only be done with kubectl edit is incorrect.
  • kubectl scale-up deployment exclusively: There is no kubectl scale-up command. The correct command is kubectl scale. Additionally, scaling is not limited to a single command; kubectl edit also works.
  • kubectl scale deployment exclusively: Although kubectl scale is a valid method, it is not the only one. kubectl edit can also be used to change the replica count, so the exclusive claim is false.