Google Associate Cloud Engineer Question 205
Select 3Google Cloud PlatformYou are tasked with deploying a stateless application on Google Kubernetes Engine (GKE) and ensuring that it scales automatically based on CPU utilization. Which steps should you take to achieve this?
- A
Create a Deployment object to manage the application pods.
- B
Configure a Horizontal Pod Autoscaler (HPA) based on CPU utilization.
- C
Use a StatefulSet to manage the application pods.
- D
Set up a LoadBalancer service to expose the application to the internet.
- E
Configure a Cluster Autoscaler to adjust the number of nodes in the cluster.
Show answer and explanation
Correct answers: A, B, D
Explanation
To deploy a stateless application on GKE that scales based on CPU utilization, you should create a Deployment to manage the application pods and a Horizontal Pod Autoscaler to adjust the number of pods based on CPU usage. Additionally, using a LoadBalancer service is essential for exposing the application to external traffic. A StatefulSet is not needed for stateless applications, and while Cluster Autoscaler helps with node scaling, it is not directly related to pod scaling based on CPU utilization.
- A. Correct.
A Deployment object is used to manage stateless applications and ensures that the specified number of pod replicas are running.
- B. Correct.
A Horizontal Pod Autoscaler automatically adjusts the number of pods in a Deployment based on observed CPU utilization or other select metrics.
- C. Incorrect.
A StatefulSet is used for stateful applications requiring stable, unique pod identifiers and persistent storage, not typically used for stateless applications.
- D. Correct.
A LoadBalancer service type exposes the application to the internet and distributes traffic across the pods, which is often necessary for web applications.
- E. Incorrect.
Cluster Autoscaler adjusts the number of nodes in the cluster but is not directly involved in scaling the number of application pods based on CPU utilization.