Kubernetes: multiple pods or multiple deployments?

6/5/2018

I am using kubernetes to deploy a simple application. The pieces are:

  • a rabbitMQ instance
  • a stateless HTTP server
  • a worker that takes jobs from the message queue and processes them

I want to be able to scale the HTTP server and the worker up and down independently of each other. Would it be more appropriate for me to create a single deployment containing one pod for the HTTP server and one for the worker, or separate deployments for the HTTP server / worker?

-- Alex Flint
kubernetes

1 Answer

6/5/2018

You should definitely choose different deployment for HTTP Server and the worker. For following reasons:

  • Your scaling characteristics are different for both of them. It does not make sense to put them in the same deployment

  • The parameters on which you will scale will be different too. For HTTP server it might be RPS and for worker application, it will number of items pending/to be processed state. You can create HPA and scale them for different parameters that suit them best

  • The metrics & logs that you want to collect and measure for each would be again different and would make sense to keep them separate.

I think the Single Responsibility principle fits well too and would unnecessarily mix things up if you keep then in same pod/deployment.

-- Vishal Biyani
Source: StackOverflow