Kubernetes: multiple pods or multiple deployments?

时间:2018-06-05 05:10:00

标签: kubernetes

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?

1 个答案:

答案 0 :(得分:4)

您绝对应该为HTTP Server和worker选择不同的部署。由于以下原因:

  • 您的缩放特征对于它们都不同。将它们放在同一部署中是没有意义的

  • 您要缩放的参数也会有所不同。对于HTTP服务器,它可能是RPS,对于工作者应用程序,它将是待处理/待处理状态的项目数。您可以创建HPA并根据最适合他们的不同参数进行缩放

  • 指标&您想要收集和测量每个日志的日志会再次不同,并且将它们分开是有意义的。

我认为单一责任原则也很合适,如果您将其保留在相同的pod /部署中,则会不必要地混淆。