Permalink
Switch branches/tags
0.17.0-patch-cherrypick 0.17.0-patch aks-20180621 aks-images aks-nil-linux-profile aks-patch-release-v0.21.2 aksrp-cherry-pick auxvendor delete-app hcp hyperkube-with-docker jack mas master new-vhd ostest patch-release-0.19.3 patch-release-0.22.4 patch-release-v0.12.1 patch-release-v0.12.2 patch-release-v0.12.3 patch-release-v0.12.4 patch-release-v0.12.5 patch-release-v0.13.1 patch-release-v0.14.1 patch-release-v0.14.2 patch-release-v0.14.3 patch-release-v0.14.4 patch-release-v0.14.5 patch-release-v0.14.6 patch-release-v0.15.1 patch-release-v0.15.2 patch-release-v0.16.1 patch-release-v0.16.2 patch-release-v0.17.1 patch-release-v0.18.1 patch-release-v0.18.2 patch-release-v0.18.3 patch-release-v0.18.4 patch-release-v0.18.5 patch-release-v0.18.6 patch-release-v0.18.7 patch-release-v0.18.8 patch-release-v0.18.9 patch-release-v0.19.1 patch-release-v0.19.2 patch-release-v0.19.3 patch-release-v0.19.4 patch-release-v0.19.5 patch-release-v0.19.6 patch-release-v0.20.1 patch-release-v0.20.2 patch-release-v0.20.3 patch-release-v0.20.4-hotfix patch-release-v0.20.4 patch-release-v0.20.5 patch-release-v0.20.6 patch-release-v0.20.7 patch-release-v0.20.8 patch-release-v0.20.9 patch-release-v0.21.1 patch-release-v0.21.2 patch-release-v0.22.1 patch-release-v0.22.2 patch-release-v0.22.3 patch-release-v0.22.4 patch-release-v0.23.1 patch-release-v0.23.2 patch-release-v0.24.1 patch-release-v0.24.2 patch-release-v0.24.3 patch-release-v0.25.1 patch-release-v0.25.2 patch-release-v0.25.3 patch-release-v0.26.1 patch-release-v0.26.2 release-aks-2018-08-15 release-v0.18.0 release-v0.19.0 release-v0.20.0 release-v0.21.0 release-v0.22.0-rc.2 release-v0.22.0 release-v0.23.0 release-v0.25.0 release-v0.26.0 v0.1.0 v0.15.0 v0.16.0-rc.5 v0.24.0 vars-back-compat vendor-dir-update
Nothing to show
Find file Copy path
73 lines (44 sloc) 3.91 KB

Microsoft Azure Container Service Engine - Swarm Mode Walkthrough

Deployment

Here are the steps to deploy a simple Swarm Mode cluster:

  1. Install acs-engine
  2. Generate your ssh key
  3. Edit the Swarm Mode example and fill in the blank strings
  4. Generate the template
  5. Deploy the output azuredeploy.json and azuredeploy.parameters.json

Walkthrough

Once your Swarm Mode cluster has been deployed you will have a resource group containing:

  1. a set of 1,3, or 5 masters in a master availability set. Each master's SSH can be accessed via the public dns address at ports 2200..2204. First master's SSH can also be accessed via public dns address on port 22.

  2. a set of agents in a VM scale set (VMSS). The agent VMs can be accessed through a master. See agent forwarding for an example of how to do this.

The following image shows the architecture of a container service cluster with 3 masters, and 3 agents:

Image of Swarm container service on azure

All VMs are in the same VNET where the masters are on private subnet 172.16.0.0/24 and the agents are on the private subnet, 10.0.0.0/16, and fully accessible to each other.

Create your First Two Swarm Mode Docker services: hello-world, and Docker web app

After completing this walkthrough you will know how to:

  • display information from Swarm Mode,
  • deploy a simple Docker hello-world app using docker-compose,
  • and deploy a simple Docker web app publically available to the world.
  1. After successfully deploying the template write down the two output master and agent FQDNs (Fully Qualified Domain Name).

    1. If using Powershell or CLI, the output parameters are the last values printed.

    2. If using Portal, to get the output you need to:

      1. navigate to "resource group"
      2. click on the resource group you just created
      3. then click on "Succeeded" under last deployment
      4. then click on the "Microsoft.Template"
      5. now you can copy the output FQDNs and sample SSH commands

      Image of docker scaling

  2. SSH to port 2200 of the master FQDN (or first master's SSH can also be accessed via public dns address on port 22.). See agent forwarding for an example of how to do this.

  3. Type docker node ls to view the list of nodes (and their status) in the Swarm. Image of docker node ls

  4. Type docker run -it hello-world to see the hello-world test app run on one of the agents (the '-it' switches ensure output is displayed on your client)

  5. Now let's create a simple service in a swarm and expose it to the world. Type docker service create --name fe --publish 80:80 yeasy/simple-web

  6. Once completed, type docker service ps fe to see the running service.

Image of docker service ps

  1. In your web browser hit the AGENTFQDN endpoint (not the master FQDN) you recorded in step #1 and you should see the following page, with a counter that increases on each refresh.

Image of the web page

  1. You can now scale the service. You can type docker service scale fe=5, and this will scale up the service to the desired number of replicas.

Image of service scaling

Learning More

Here are recommended links to learn more about Swarm Mode, Docker, and Docker Compose:

  1. Docker - learn more through Docker documentation.

  2. Docker Swarm Mode - learn more about Docker Swarm Mode.