I am using kubernetes to deploy a simple application. The pieces are:
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?
Why does Kubernetes allow more than one container in a Pod? Containers in a Pod runs on a "logical host": they use the same network namespace (same IP address and port space), IPC namespace and, optionally, they can use shared volumes. Therefore, these containers can efficiently communicate, ensuring data locality.
Their Role in Building and Managing Software As we now know, a pod is the smallest unit of Kubernetes used to house one or more containers and run applications in a cluster, while deployment is a tool that manages the performance of a pod.
A Deployment is meant to represent a single group of PODs fulfilling a single purpose together. You can have many Deployments work together in the virtual network of the cluster. For accessing a Deployment that may consist of many PODs running on different nodes you have to create a Service.
For these reasons, Kubernetes recommends a maximum number of 110 pods per node. Up to this number, Kubernetes has been tested to work reliably on common node types.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With