Kubernetes one service multiple deployments. Pros and cons?

3/18/2020

In this question the accepted answer shows how to have multiple deployments in a single service so they can talk to each other using their internal loadbalancer ports. What are the pros and cons? My guesses:

Pros:

  • Easier to deploy?
  • Easier communication between pods (no need for ingress)?
  • Is there any added security since the backend could be accesses only from within the cluster?

Cons:

  • You have to deploy all of the connected pods every time (not a microservice architecture)?
-- Alejandro Camus
kubernetes
kubernetes-ingress
kubernetes-pod

1 Answer

3/18/2020

The only common reason to have multiple deployments in one service is for blue/green stuff, or maybe canary deploys (though usually that's done via a proxy with better control over the canary scaling factors). Beyond that, it comes up pretty rarely, sometimes maybe for integrating with Prometheus Operator's ServiceMonitor, or very niche tricks with in-place system rewrites.

-- coderanger
Source: StackOverflow