Docker Swarm
- Master slave configurations
- At least three masters(From two is okay)- Odd numbers for masters is recommended
- A maximum of 7 master nodes is recommended by docker
Creating a swarm
- Identify the master
- initiaize the cluster
- Chose an interface to advertise
Managers
- Getting command to run as manager
Promoting a worker node to manager
-
You can promote a node from a manager
docker-node2
is the hostname of the node -
To update the hostname
Prevent manager from running services
- Run the command from a manager
docker-master
is the hostname.
Note
If the cluster is left with less than half of the managers, reinitializing the swarm can fix it if bringing the managers back up is not possible.
command: docker swarm init --force-new-cluster --advertise-addr 192.168.56.1
Nodes
-
Getting command to run as manager
-
Listing
-
Leaving a swarm
-
Takes some time to reflect on the master
-
Leaving
Secrets
printf "my super secret password" | docker secret create my_secret -
onakdyv307se2tl7nl20anokv
docker secret ls
ID NAME CREATED UPDATED
onakdyv307se2tl7nl20anokv my_secret 6 seconds ago 6 seconds ago
Services
Two types of services
- Replicated -
- Global (Placed on every node, eg monitoring tools)