Google Associate Cloud Engineer Question 206
Select 1Google Cloud PlatformYou are tasked with deploying a stateless application on Google Kubernetes Engine (GKE) that needs to scale based on CPU usage. Which combination of Kubernetes resources would best achieve this goal?
- A
Deployment and HorizontalPodAutoscaler
- B
StatefulSet and HorizontalPodAutoscaler
- C
DaemonSet and ResourceQuota
- D
Deployment and ConfigMap
- E
Pod and PersistentVolumeClaim
Show answer and explanation
Correct answer: A
Explanation
The best approach to deploy a stateless application on Google Kubernetes Engine (GKE) that can scale based on CPU usage is to use a Deployment in conjunction with a HorizontalPodAutoscaler. The Deployment manages the Pods for the stateless application, while the HorizontalPodAutoscaler adjusts the number of Pods based on CPU utilization or other metrics.
- A. Correct.
Using a Deployment allows you to manage stateless applications and provides declarative updates for Pods and ReplicaSets. The HorizontalPodAutoscaler automatically scales the number of Pods in a Deployment based on observed CPU utilization or other select metrics.
- B. Incorrect.
A StatefulSet is typically used for stateful applications that require persistent storage and ordered deployment. While you can use a HorizontalPodAutoscaler with a StatefulSet, it is not ideal for stateless applications.
- C. Incorrect.
A DaemonSet ensures that all (or some) nodes run a copy of a Pod. It is not used for scaling based on CPU usage. ResourceQuota is used to limit resources within a namespace and is unrelated to auto-scaling metrics.
- D. Incorrect.
A ConfigMap is used to store configuration data for applications separately from Pods. It is unrelated to scaling applications based on CPU usage.
- E. Incorrect.
A Pod is the smallest deployable unit in Kubernetes, and a PersistentVolumeClaim is used for requesting storage resources. This combination does not address scaling based on CPU usage.