Google Professional Cloud Developer Question 365
Select 3Google Cloud PlatformYou are deploying a stateless web application to Google Kubernetes Engine (GKE) and need to ensure that the application scales automatically based on CPU utilization while maintaining high availability. Which of the following configurations should you include in your deployment?
- A
Define a Horizontal Pod Autoscaler (HPA) for the deployment to scale pods based on CPU utilization.
- B
Set the 'replicas' field in the Deployment manifest to a fixed number of pods.
- C
Use a Deployment object to manage the application pods and define a minimum and maximum number of replicas in the HPA configuration.
- D
Use a StatefulSet instead of a Deployment to ensure scaling and high availability.
- E
Configure GKE's cluster autoscaler to dynamically add or remove nodes based on cluster workload.
Show answer and explanation
Correct answers: A, C, E
Explanation
To deploy a stateless web application to GKE with automatic scaling and high availability, you should use a Deployment object for managing stateless workloads, configure a Horizontal Pod Autoscaler (HPA) to scale pods based on CPU utilization, and enable GKE's cluster autoscaler to dynamically adjust the cluster size based on workload demands. These configurations ensure both horizontal scaling of pods and the ability to handle increased workloads at the cluster level.
- A. Correct.
Correct: Horizontal Pod Autoscaler (HPA) is required to automatically scale pods based on CPU or memory utilization metrics.
- B. Incorrect.
Incorrect: Setting a fixed number of replicas does not enable automatic scaling based on CPU utilization. This is a static approach.
- C. Correct.
Correct: A Deployment object is suitable for stateless applications, and the HPA can be used to define minimum and maximum replica limits.
- D. Incorrect.
Incorrect: StatefulSets are not necessary for stateless applications. They are designed for stateful applications that require persistent identity and storage.
- E. Correct.
Correct: GKE's cluster autoscaler ensures that nodes in the cluster can dynamically scale based on the overall workload, complementing the HPA.