Questão de Container Orchestration #019e3a4f
What methods can you use to scale a deployment?
With kubectl edit deployment exclusively.
With kubectl scale-up deployment exclusively.
With kubectl scale deployment and kubectl edit deployment.
With kubectl scale deployment exclusively.
Explicação Oficial / Explicações da Comunidade
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=5updates the replica count immediately.kubectl edit deployment: This command opens the deployment's YAML manifest in an editor, allowing you to modify any field, includingspec.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 deploymentexclusively: Whilekubectl editcan scale a deployment, it is not the only method.kubectl scaleis a dedicated command for scaling and is often more efficient. Therefore, stating that scaling can only be done withkubectl editis incorrect.kubectl scale-up deploymentexclusively: There is nokubectl scale-upcommand. The correct command iskubectl scale. Additionally, scaling is not limited to a single command;kubectl editalso works.kubectl scale deploymentexclusively: Althoughkubectl scaleis a valid method, it is not the only one.kubectl editcan also be used to change the replica count, so the exclusive claim is false.