Question 126
You are developing an application using different microservices that should remain internal to the cluster. You want to be able to configure each microservice with a specific number of replicas. You also want to be able to address a specific microservice from any other microservice in a uniform way, regardless of the number of replicas the microservice scales to. You need to implement this solution on Google Kubernetes Engine. What should you do?
Show Answer
Use a Deployment to manage the desired replica count for each stateless microservice. Expose each Deployment with an internal Kubernetes Service, which provides a stable virtual IP and DNS name that remains constant as Pods scale up, down, or are replaced. Other microservices should communicate using the Service's DNS name. Ingress is intended primarily for external HTTP(S) access, not internal service-to-service communication, and deploying standalone Pods does not provide replica management.