Google Professional Cloud Developer Question 70
Select 2Google Cloud PlatformYour team has deployed a web application on Google Kubernetes Engine (GKE). The application experiences variable traffic throughout the day, with significant spikes during business hours and minimal usage outside of those hours. As a Professional Cloud Developer, how can you optimize both cost and resource utilization for this application?
- A
Configure cluster autoscaling on the GKE cluster to dynamically adjust the number of nodes based on workload.
- B
Use preemptible VMs for the GKE cluster nodes to reduce costs during low-traffic periods.
- C
Manually scale the number of pods in your deployment every hour to match predicted traffic patterns.
- D
Configure horizontal pod autoscaling (HPA) to scale the number of pods in your application based on CPU or memory usage.
- E
Migrate the application to Cloud Functions to take advantage of a fully serverless environment.
Show answer and explanation
Correct answers: A, D
Explanation
To optimize cost and resource utilization for a GKE-based application, you can use cluster autoscaling to dynamically adjust the number of nodes in your cluster based on workload demands, and horizontal pod autoscaling (HPA) to scale the number of pods based on resource utilization. These approaches ensure that resources are provisioned only when needed, reducing costs during low-traffic periods while maintaining performance during peak traffic.
- A. Correct.
This is correct because cluster autoscaling in GKE adjusts the number of nodes in your cluster dynamically based on the workloads. This ensures optimal resource utilization and reduces costs by scaling down during off-peak hours.
- B. Incorrect.
This is incorrect because preemptible VMs are not ideal for workloads requiring high availability, such as a web application. Preemptible VMs can be terminated at any time, which can cause disruptions.
- C. Incorrect.
This is incorrect because manually scaling the pods is not efficient or practical, especially for workloads with unpredictable traffic patterns.
- D. Correct.
This is correct because horizontal pod autoscaling (HPA) automatically adjusts the number of pods in your application based on resource utilization metrics like CPU or memory. This ensures cost efficiency and high availability during traffic spikes.
- E. Incorrect.
This is incorrect because migrating to Cloud Functions would require significant re-architecture of the application. While serverless may be cost-efficient for some use cases, it is not necessarily the optimal solution for an existing GKE-based application.