
Answer-first summary for fast verification
Answer: Update the number of replicas in the YAML file and rerun the `kubectl apply` command.
The correct answer is **C** because Kubernetes Deployments are managed through desired state configuration. To update the number of replicas, you should edit the `replicas` field in the YAML file and apply the changes using `kubectl apply`. This method ensures that your infrastructure's desired state is consistently maintained through configuration files. - **Option A** is incorrect because `kubectl scale` bypasses the configuration file, which contradicts the team's goal of using desired state configuration. - **Option B** is not a valid method for updating the desired state directly within Kubernetes. - **Option D** is incorrect as the `kubectl set image` command is used for updating container images, not for adjusting the number of replicas. For more details, refer to the [GCP documentation on Kubernetes Scaling Apps](https://cloud.google.com/kubernetes-engine/docs/concepts/scaling-apps).
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
Your team is excited about implementing desired state configuration for your infrastructure, particularly by storing Kubernetes Deployments in YAML. After creating a Kubernetes Deployment using the kubectl apply command with a YAML file, you now need to adjust the number of replicas. What is the correct approach to update the Deployment?
A
Use the kubectl scale command to immediately adjust the number of replicas.
B
Modify the number of replicas in the YAML file and push the changes to GitHub to trigger a deployment.
C
Update the number of replicas in the YAML file and rerun the kubectl apply command.
D
Change the number of replicas in the YAML file and execute the kubectl set image command.
No comments yet.