What would Docker Swarm look like without?
Let's say we have a cluster with three nodes. Two of them run Swarm managers, and one is a worker. Managers accept our requests, decide what should be done, and send tasks to Swarm workers. In turn, workers translate those tasks into commands that are sent to the local Docker Engine. Managers act as workers as well.
If we describe the flow we did earlier with the go-demo
service, and imagine there is no service discovery associated with Swarm, it would be as follows. A user sends a request to one of the managers. The request is not a declarative instruction but an expression of the desired state. For example, I want to have two instances of the go-demo
service and one instance of the DB
running inside the cluster:
Figure 4-1: User sends a request to one of the managers
Once Swarm manager receives our request for the desired state, it compares it with the current state of the cluster, generates tasks, and sends them to Swarm workers. The tasks might...