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

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.