
Answer-first summary for fast verification
Answer: Define a GKE Service. Clients should use the service name in the URL to connect to the service.
In GKE, when a Service is defined, it is automatically assigned a DNS name that resolves to its ClusterIP. Clients within the same cluster can use the service name directly in their requests (e.g., `http://service-name`), which is resolved to the service's IP by the cluster's internal DNS (kube-dns/CoreDNS). Option B is correct because it leverages the built-in DNS resolution without requiring external Cloud DNS (Option A) or manual endpoint handling (Options C/D). Cloud DNS (Options A/D) is unnecessary here as the cluster's internal DNS handles service discovery. GKE Endpoints (Options C/D) refer to pod IPs, not the service's ClusterIP, making them irrelevant for obtaining the service's IP.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You are building a JPEG image-resizing API deployed on Google Kubernetes Engine (GKE). Clients calling the service will run within the same GKE cluster. You need to ensure these clients can retrieve the service's IP address.
What is the correct approach?
A
Define a GKE Service. Clients should use the name of the A record in Cloud DNS to find the service's cluster IP address.
B
Define a GKE Service. Clients should use the service name in the URL to connect to the service.
C
Define a GKE Endpoint. Clients should get the endpoint name from the appropriate environment variable in the client container.
D
Define a GKE Endpoint. Clients should get the endpoint name from Cloud DNS.
No comments yet.