Clustered Docker environment

3/19/2021

I am new to Docker and containerization. As a result, I am looking for some reference to address the solution I am looking for. In the old-fashion java web application, there was the concept of clustered app servers. A load balancer could be applied to dispatch the incomming requests between the cluster nodes. Now I am looking for a similar solution, using Docker and Kubernetes. In very simple words, I would like my application to appear like a single node from outside, with a single IP, but in the case the the load on the system increased, new instances of the same Docker be generated, and the load is dispatched between them automatically. I couldn't find out the right keywords to search for it. So it will be great if you can give me some hints to find out the right materials. As I mentioned, I am very new to containerization. So, please don't assume anything about my post. If you think it doesn't make sense and I am mixing Oranges and Apples, please let me know. Thank you in advance.

-- user3800500
cluster-computing
docker
kubernetes

1 Answer

3/19/2021

From an infrastructure perspective this is exactly, what kubernetes provides: You provide your application as a docker image and define a Deployment in kubernetes which will provide a defined number of instances (Pod) of your application. To access it inside kubernetes you define a Service which is a single, virtual, ip to make your application appear as one instance. Kubernetes will round-robin requests to all Pods.

Your application is responsible to replicate state or hold it in a central store, if required. Therefore a stateless application is the best fit.

To access your application from the outside you can use a LoadBalancer and/or Ingress object.

Automatic scaling can be performed by kubernetes as well, but it does not do that out of the box.

-- Thomas
Source: StackOverflow