Docker swarm manager worker and configuring UCP console

What is Swarm Mode

Swarm mode enables us to create a cluster of one or more Docker engines called a swarm.
A swarm consists of one or more nodes: physical or virtual machine running Docker engine 1.12 or Later in swarm mode.

We have two types of nodes :- managers and workers

I1

Manager Node

Manager node handles cluster management tasks :-

  • Maintaining cluster state
  • Scheduling services
  • Serving swarm mode (HTTP API endpoints)

The managers maintains a consistent internal state of the entire swarm and all the services running on it. When you have multiple managers you can recover from the failure of a manager node without downtime.

  • A three-manager swarm tolerates a maximum loss of one manager.
  • A five-manager swarm tolerates a maximum simultaneous loss of two manager nodes.
  • An N manager cluster tolerates the loss of at most (N-1)/2 managers.

Worker Node

Worker nodes are also instances of Docker engine whose sole work is to execute containers. They don’t participate in scheduling decisions , or server the swarm mode HTTP API.

We can create a swarm of one manager node but we cann’t create a swarm of one worker node with a manager node.

By default all managers are also workers to make sure manager doesn’t execute and tasks by scheduler we can keep the manager in Drain mode so the Scheduler will assign task to nodes which are in active mode.

Changes roles

The node can change their roles also a Manager node can be demoted to worker node and in similar fashion a worker node can be promoted to Manager node.
This are called (Node demote and Node Promote respectively).

Setting Up Swarm (Configure Managers)

Follow below steps to initialize a machine as docker manager

Run this command

docker swarm init –advertise-addr <> (IP address where we want to initialize the swarm)

$ docker swarm init --advertise-addr 192.168.99.121
Swarm initialized: current node (bvz81updecsj6wjz393c09vti) is now a manager.

To add a worker to this swarm, run the following command:

docker swarm join \
–token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx \
172.17.0.2:2377

To add a manager to this swarm, run ‘docker swarm join-token manager’ and follow the instructions

Setting Up Swarm (Configure Worker)


[root@devops811c cloud_user]# docker swarm join-token worker
To add a worker to this swarm, run the following command:
docker swarm join--token SWMTKN-1-3u6nln8dlxamz29t0a6ig9aq1sv0vdjydkud3mimy63n7s0h91-7q89jt2v51wchy4aqcown7o8k 172.31.29.239:2377

Configuring UCP

Login to the server which is configured as manager and execute below command :-

docker container run --rm -it --name
ucp   -v /var/run/docker.sock:/var/run/docker.sock   docker/ucp:3.2.1 install   --host-address 172.31.29.239   --interactive --force-minimums
I2

Once UCP is configured it can be accessed using IP :- https://<>:443/

We should get below UCP login page :-

I3

Once we login successfully we will get a upload License option so we can click on Get a Free trial license and click on option START 1 MONTH TRIAL.

I4

Click on the License Key it will download the license with .Lic extention next we have to go to upload license window click on upload license button browse the LIC file. Once the license is uploaded successfully we can see the UCP Login window.

I5

Click on admin and then click shared resourcces >> Nodes it will give us glimpse of currently running nodes and managers.

I6

 

Leave a Reply