Google Cloud Professional Cloud Developer — Question 23
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?
Answer options
- 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.
Correct answer: B
Explanation
The correct answer is B because defining a GKE Service allows clients within the same cluster to use the service name in the URL to access it directly. Option A is incorrect as it involves Cloud DNS, which is unnecessary for internal communication within the same cluster. Options C and D are also wrong because using Endpoints instead of a Service does not provide the same convenience for service discovery within the cluster.