LeetQuiz Logo
Privacy Policy•contact@leetquiz.com
© 2025 LeetQuiz All rights reserved.
Google Associate Cloud Engineer

Google Associate Cloud Engineer

Get started today

Ultimate access to all questions.


Your team is aiming to use desired state configuration for your application deployed on a GKE cluster. You have YAML files for Kubernetes Deployment and Service objects. The application is designed to run with 2 pods, as specified by the replicas parameter in app-deployment.yaml. The service utilizes a GKE Load Balancer, defined in app-service.yaml. After creating the Kubernetes resources with kubectl apply -f app-deployment.yaml and kubectl apply -f app-service.yaml, the deployment is now live but experiencing performance issues. To address this, you decide to increase the number of replicas to 5. What is the correct approach to update the replicas in the existing Kubernetes deployment objects?

Real Exam



Explanation:

The correct approach is to edit the number of replicas in the YAML file and rerun kubectl apply -f app-deployment.yaml. This method ensures that the desired state configuration is updated and preserved in the YAML file. Other methods, such as using kubectl scale or kubectl autoscale, achieve the same immediate outcome but do not update the YAML file. Consequently, any future kubectl apply commands would revert the replica count to the original value specified in the YAML file, which is undesirable. Similarly, using kubectl edit modifies the live configuration but does not update the local YAML file, leading to the same issue. References: Kubernetes Deployment Scaling, Kubernetes Autoscaling, and Managing Deployments.

Powered ByGPT-5