Questions? Feedback? powered by Olark live chat software
Ignorar Navegação

Docker Swarm Clusters on Azure

Publicado em 5 outubro, 2015

Software Engineer, Azure Linux

We are excited to announce we have just made creating Docker Swarm clusters on Azure as simple as only a few clicks. With the expressive power of Azure Resource Manager Templates, you can deploy a Docker Swarm cluster of almost any size to Azure in a few minutes.

Docker Swarm is a native clustering tool for Docker which turns multiple Docker engines into a cluster and makes that a cluster by making it look like a single Docker engine. It's easier to install than any other container orchestrator. This way, you can create a pool of Virtual Machines that are container hosts and scale out your applications using Docker as if you were using a single VM.

In this sense, Docker Swarm is a very practical and easy solution to the container orchestration problem and you can deploy containers to the cluster with the docker command-line tool which you already might be familiar with.

Please do not forget to check out the Azure Container Service announcements of last week to learn more about our broader plans for supporting containerized applications on Azure.

Docker Swarm ARM template

To deploy Docker Swarm clusters to Azure, we developed an Azure Resource Manager Template, which provisions various resources on Azure that form the Swarm cluster and we made it available as open source on GitHub.

With this template, you can provision Docker Swarm clusters within 5-10 minutes by deploying the template from the the templates gallery or by downloading it from GitHub and then using either Azure CLI or Azure PowerShell module on your development machine.

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. This ensures the control plane with which you deploy and manage your containers remains highly available. These manager VMs are of the smallest size, “Standard_A0,” as they do not run the user workloads and just serve as cluster managers.

The swarm manager nodes run two containers: the swarm agent and Consul to discover the swarm worker nodes. We add the Azure Docker Extension to the Virtual Machines to systematically run these containers after provisioning the VM. The individual swarm worker nodes join the cluster by reaching out to swarm managers using their static private IP addresses. All the swarm manager and worker nodes are in the same Azure Virtual Network, so that they can talk to each other. The manager nodes 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; however, they are behind an Azure Load Balancer that can be configured to route the traffic to containers. The worker nodes accepting container workloads are of size “Standard_A2.”

The network topology of the cluster looks like the following:

Docker Swarm Cluster on Azure Network Topology

The virtual machines provisioned for the cluster run CoreOS, a minimal Linux distribution that ships with Docker installed, as the host operating system. This helps us to provision and configure the cluster quickly.

Using this template, a 50-node Swarm cluster provisions usually within 5-10 minutes and it is ready to accept container workloads.

The template also saves you from the trouble of managing the Docker certificates by not using TLS and letting you access the Docker Swarm endpoint by establishing a SSH tunnel.

Please read the instructions on the GitHub repository to learn more details about the cluster topology.

Demo

The video below demonstrates how easy it is to create a Swarm cluster from the Azure Portal:

Try it out!

Docker Swarm is a useful tool that allows you to turn your VMs into a pool of container hosts without going through the pain of installing a fully-fledged container orchestrator. It is easy to set up and manage small and medium-sized distributed workloads.

If you are interested in kicking the tires off in Azure with Docker Swarm clusters, please check out the ARM template and deploy a cluster within a few minutes!