Creating a Swarm Cluster in Azure

To create a Swarm cluster in Azure:
  1. Use this Docker template to proceed with swarm deployment. https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fdownload.docker.com%2Fazure%2Fstable%2F18.03.0%2FDocker.tmpl
    Note: This is an older template. We recommend using the older template. Using the latest template results in the following error:
    {
      "error": {
        "code": "ImageNotFound",
        "target": "imageReference",
        "message": "The platform image 'docker:docker-ce:docker-ce:1.0.12' is not available. Verify that all fields in the storage profile are correct."
      }
    }
  2. Fill the following fields in the template:
    • Choose the Resource Group from the list, for example: spswarm
    • AD ServicePrincipal App ID
    • AD ServicePrincipal App Secret
    • Linux SSH Public Key: You the contents from ~/.ssh/azswarm_rsa.pub
    Click 'Purchase' link. If everything goes well, it takes around 5 minutes for the Docker swarm deployment.



Configure the SSH Agent forwarding, this is required to communicate between manage nodes and worker nodes.

  1. Run the command to know the list of identities added to the agent.
    CMD:
    ssh-add -L
  2. If you don't see any identities added to agent, then run this command.
    CMD:
    ssh-add ~/.ssh/your_key
  3. Get the Manager IP and Port Number from the Deployed template. Go to the deployed Microsoft template under the resource group and get the SSH target URL and browse to retrieve the IP of the manager node and port number.



  4. Enable SSH forwarding per session by using -A flag.
    CMD:
    ssh -A -p <portNumber> docker@<manager_ip>
  5. After step 3, now you will be able to connect to worker node from master, you cannot directly connect to worker nodes from outside.
    CMD:
    ssh docker@<internal IP of Worker Node>
  6. After building the Mashery Local images, transfer the Mashery Local Images to Master machine and Worker Machine.
    1. Transfer the images to Manager Node.
      CMD:
      scp -i ~/.ssh/<your_key> -P 50000 <Image_Name> docker@<Manager_IP>/home/docker
    2. Transfer the images from Manager Node to Worker Node
      Login to Manager Node:
      ssh -A -p <portNumber> docker@<manager_ip> 
      From Manager Node Login to Worker Node:
      scp <Image_Name> docker@<internal IP of Worker Node>:/home/docker