
Answer-first summary for fast verification
Answer: Create a Service of type ClusterIP for Deployment A. Deployment B should use the Service IP address.
The correct answer is **D** because it exposes the service on a cluster-internal IP address, making it accessible only within the cluster. This method ensures that Deployment-A is not exposed to the public internet. - **Option A** is incorrect as it would expose Deployment-A over the public internet. - **Option B** is incorrect because using a LoadBalancer would also expose the service publicly. - **Option C** is incorrect as it involves exposing the service externally using a cloud provider’s load balancer, and Ingress does not work with LoadBalancer in this context. For more details, refer to the [GCP documentation on Kubernetes Networking](https://cloud.google.com/kubernetes-engine/docs/concepts/network-overview).
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
You've set up a Kubernetes deployment named Deployment-A with 3 replicas in your cluster. Deployment-B requires access to Deployment-A, but Deployment-A must not be exposed outside the cluster. What's the best approach?
A
Establish a Service of type NodePort for Deployment A and an Ingress Resource for that Service. Deployment B should then use the Ingress IP address.
B
Set up a Service of type LoadBalancer for Deployment A. Deployment B should use the Service IP address.
C
Create a Service of type LoadBalancer for Deployment A and an Ingress Resource for that Service. Deployment B should use the Ingress IP address.
D
Create a Service of type ClusterIP for Deployment A. Deployment B should use the Service IP address.