Microsoft has just announced on its Azure Blog that it has made creating Docker Swarm clusters on Azure a piece of cake through a blog post by Ahmet Alp Balkan,
Docker Swarm, for those who don’t know turns a group of Docker engines into a single, virtual Docker Engine. This enables you can scale out your application as if it were running on a single VM.
You can use the Azure Resource Manager Templates to deploy a Docker Swarm cluster of almost any size to Azure in a few minutes. Docker Swarm is an easy solution to the container orchestration problem and you can deploy containers to the cluster with Docker’s command-line tool.
Availability
Microsoft has developed an Azure Resource Manager Template to deploy Docker Swarm clusters to Azure. It can be downloaded either from GitHub or the Azure templates gallery, after which you can implement it by using either Azure CLI or Azure PowerShell module on your system.
Please read the instructions on the GitHub repository to learn more on how to deploy and use the Swarm cluster.
How it works
The Docker Swarm ARM template creates three swarm manager VMs with static private IP addresses to ensure that the control plane with which you deploy and manage your containers remains highly available. As these manager VMs don’t run user workloads and only serve as cluster managers, they’re created with the smallest size, i.e. “Standard_A0.
The swarm manager nodes run two containers: the swarm agent and Consul to discover swarm worker nodes. You have to add the Azure Docker Extension to the VMs to systematically run these containers after provisioning the VM.
Individual swarm worker nodes join the cluster by reaching out to swarm managers on their static private IP addresses. The swarm manager and worker nodes are in the same Azure Virtual Network so that they can talk to each other. The manager and worker nodes are behind separate Azure Availability Sets to ensure maximum availability and uptime. The swarm worker nodes are not exposed to public Internet directly, but are instead behind an Azure Load Balancer that can be configured to route traffic to containers. The worker nodes accepting container workloads are of size “Standard_A2.”
The virtual machines provisioned for the cluster run CoreOS, a minimal Linux distribution that ships with Docker installed, as the host operating system to help provision and configure the cluster quickly.
By using this template, a 50-node Swarm cluster can usually be provisioned within 5-10 minutes and is ready to accept container workloads. The template also saves the trouble of managing Docker certificates by not using TLS, and by letting you access the Docker Swarm endpoint by establishing a SSH tunnel.
Demo
You can see a demo video of how to create a Swarm cluster by clicking here.
You can get more details about the cluster topology on the GitHub repository. Click here to read the instructions.