Google Professional Cloud Developer Question 361
Select 3Google Cloud PlatformYou are deploying a stateless web application to Google Kubernetes Engine (GKE). The application needs to handle high traffic spikes while keeping costs minimal. Which configuration considerations should you implement?
- A
Use a horizontal Pod autoscaler to scale Pods based on CPU utilization.
- B
Configure a node selector to ensure Pods are only scheduled on preemptible VMs.
- C
Set up a liveness probe to ensure Pods are restarted if they become unresponsive.
- D
Deploy a StatefulSet instead of a Deployment to manage Pods.
- E
Use Cluster Autoscaler to automatically adjust the size of the GKE cluster.
Show answer and explanation
Correct answers: A, C, E
Explanation
To deploy a stateless web application that handles high traffic spikes while optimizing costs, you should use a horizontal Pod autoscaler to scale Pods based on demand, configure a liveness probe to ensure reliability, and enable the Cluster Autoscaler to dynamically adjust cluster size. These configurations ensure scalability, reliability, and cost-efficiency. Preemptible VMs and StatefulSets are not appropriate for this scenario due to their limitations and unsuitability for stateless workloads, respectively.
- A. Correct.
Using a horizontal Pod autoscaler allows the application to dynamically scale the number of Pods based on CPU or other metrics, ensuring it can handle traffic spikes effectively.
- B. Incorrect.
Preemptible VMs are cost-effective but not ideal for handling high traffic spikes due to their short lifespan; Pods may be evicted unexpectedly.
- C. Correct.
A liveness probe ensures that unresponsive Pods are restarted, improving the application's reliability during traffic spikes.
- D. Incorrect.
StatefulSets are designed for stateful applications and are not suitable for this stateless web application. Deployments are more appropriate for stateless workloads.
- E. Correct.
The Cluster Autoscaler automatically adjusts the size of the GKE cluster, adding or removing nodes as needed, which helps handle high traffic spikes while optimizing costs.