Google Professional Cloud Network Engineer Question 580
Select 2Google Cloud PlatformYou are designing a Google Cloud environment to host a containerized application in Google Kubernetes Engine (GKE). The application requires specific port allocations for both internal and external services. You need to ensure external clients can access the application on a specific port (e.g., port 8080), while internal services should use dynamically allocated ports to ensure flexibility. How can you configure the port allocations correctly?
- A
Configure a Kubernetes Service of type LoadBalancer and specify port 8080 for the external clients.
- B
Use a Kubernetes NodePort Service to expose port 8080 directly on the node's IP address for external access.
- C
Use a Kubernetes ClusterIP Service and rely on dynamic port allocation for internal services.
- D
Manually configure static port allocation in the GKE node pool settings for internal services.
Show answer and explanation
Correct answers: A, C
Explanation
To meet the requirements, you need to use a LoadBalancer Service to expose the application externally on a specific port (8080) and a ClusterIP Service for internal communication with dynamically allocated ports. This approach ensures proper configuration for both external and internal access while adhering to best practices in Google Cloud Kubernetes environments.
- A. Correct.
This is correct. A Kubernetes Service of type LoadBalancer allows you to expose your application to external clients and can be configured to listen on a specific static port, such as 8080.
- B. Incorrect.
This is incorrect because NodePort exposes the application directly on the node's IP, which is generally not recommended for production environments when using GKE, as it bypasses the cloud load balancer.
- C. Correct.
This is correct. A Kubernetes ClusterIP Service is used for internal communication within the cluster and dynamically allocates ports to ensure flexibility and scalability.
- D. Incorrect.
This is incorrect because static port allocation cannot be manually configured for internal services in the GKE node pool settings. GKE dynamically manages port assignments for internal services.