Google Professional Cloud Developer Question 371
Select 3Google Cloud PlatformYou are tasked with deploying a containerized application to Google Kubernetes Engine (GKE). The application requires horizontal scaling based on CPU utilization and needs to expose an external IP address to be accessed by users. Which steps should you take to meet these requirements?
- A
Define a Kubernetes Deployment with the container image and configure resource requests and limits.
- B
Create a Horizontal Pod Autoscaler (HPA) based on CPU utilization for the Deployment.
- C
Deploy a Kubernetes Service of type LoadBalancer to expose the application externally.
- D
Use a NodePort Service to expose the application externally and configure an Ingress for load balancing.
- E
Manually scale the Deployment by increasing the replica count to handle traffic spikes.
Show answer and explanation
Correct answers: A, B, C
Explanation
To deploy a containerized application to GKE with horizontal scaling based on CPU utilization and external access, you must create a Kubernetes Deployment to describe the application, configure an HPA to enable automatic scaling, and use a Service of type LoadBalancer to expose the application externally. These components work together to meet the specified requirements efficiently.
- A. Correct.
Defining a Kubernetes Deployment with the container image and configuring resource requests and limits is a standard step for deploying a containerized application. Resource requests and limits are essential for enabling the Horizontal Pod Autoscaler to function properly.
- B. Correct.
Creating a Horizontal Pod Autoscaler (HPA) based on CPU utilization ensures that the application can scale automatically to handle variable traffic loads, which aligns with the requirement for horizontal scaling.
- C. Correct.
Deploying a Kubernetes Service of type LoadBalancer is necessary to expose the application externally with an external IP address.
- D. Incorrect.
Using a NodePort Service and configuring an Ingress is another way to expose the application, but the question explicitly requires exposing the application via an external IP address, which a Service of type LoadBalancer directly provides.
- E. Incorrect.
Manually scaling the Deployment does not fulfill the requirement for horizontal scaling based on CPU utilization, as HPA is needed for automatic scaling.