PROFESSIONAL-CLOUD-DEVELOPER · Question #50
You are developing a JPEG image-resizing API hosted on Google Kubernetes Engine (GKE). Callers of the service will exist within the same GKE cluster. You want clients to be able to get the IP address
The correct answer is B. Define a GKE Service. Clients should use the service name in the URL to connect to the service.. In Kubernetes (GKE), a Service is the correct resource for exposing a stable network endpoint to other pods within the same cluster. Kubernetes automatically creates a DNS entry for every Service using the format service-name.namespace.svc.cluster.local. Clients within the same c
Question
You are developing a JPEG image-resizing API hosted on Google Kubernetes Engine (GKE). Callers of the service will exist within the same GKE cluster. You want clients to be able to get the IP address of the service. What should you do?
Options
- ADefine a GKE Service. Clients should use the name of the A record in Cloud DNS to find the
- BDefine a GKE Service. Clients should use the service name in the URL to connect to the service.
- CDefine a GKE Endpoint. Clients should get the endpoint name from the appropriate environment
- DDefine a GKE Endpoint. Clients should get the endpoint name from Cloud DNS.
How the community answered
(29 responses)- A7% (2)
- B72% (21)
- C17% (5)
- D3% (1)
Explanation
In Kubernetes (GKE), a Service is the correct resource for exposing a stable network endpoint to other pods within the same cluster. Kubernetes automatically creates a DNS entry for every Service using the format service-name.namespace.svc.cluster.local. Clients within the same cluster can use the service name directly in their URLs (e.g., http://image-resizer/resize), without needing to look up an IP address. This is the standard, recommended Kubernetes service discovery pattern. Option A is partially correct (services do get DNS A records) but the framing of 'looking up the A record in Cloud DNS' is not how intra-cluster service discovery typically works - the cluster DNS (CoreDNS) handles it, not Cloud DNS. Options C and D incorrectly use 'GKE Endpoint,' which is not a standard Kubernetes resource for service exposure.
Topics
Community Discussion
No community discussion yet for this question.