Docker Swarm Setup

Use Case

Set up a multi node docker swarm cluser

References

  1. Raft Consensus Algorithm
  2. Docker Swarm

Dataflow Diagram

Session 1:

  • Set up docker swarm cluster on multiple Ubuntu nodes
    1. What is docker swarm mode? Raft consensus
      • Leader Election
      • Log Replication
    2. Perpare the VMs
      • Copy public key
      • Add Ubuntu user
      • Copy SSH keys to the the Ubuntu user
      • Disable root login and password authentication
      • Enable Ubunut firewall and allow traffic on private network
    3. Install required packages
      • Install Docker
      • Verify docker is installed
      • [Optional] Install AWS CLI if using AWS Secrets manager
      • [Optional] AWS Access Keys
      • Enable log rotate of docker container logs to avoid excessive disk usage
    4. Configure docker swarm cluster
      • Initialize docker swarm on the first host
        • Advertise the docker swarm network on the private network only
      • Copy the docker swarm join tokens to AWS Secrets manager
      • Add rest of the nodes to docker swarm
        • Obtain the join tokens from AWS Secrets manager
        • Join the docker swarm with the first node on the private network only and advertise private network only

Video explanation of the code

Docker-Swarm-Setup

Source Code

comments powered by Disqus