The newly introduced Azure Container Service (ACS) provides container hosting environment in the cloud. It provides a way to simplify the creation, configuration, and management of a cluster of virtual machines that are preconfigured to run containerized applications. You can use this service to deploy and manage container-based applications on Microsoft Azure.
ACS uses Docker to to ensure that your application containers are fully portable. It also supports the following :
- DCOS Marathon or DCOS Chronos framework for automation on
- Apache Mesos or Docker Swarm clusters
to ensure that these applications can be scaled to thousands, even tens of thousands of containers.These clusters are deployed using Azure Virtual Machine Scale Sets, and take advantage of Azure networking and storage offerings.
When you start deploying an Azure Container Service, an ACS cluster is deployed using an Azure Resource Manager template. This deployment can be configured with different size and availability options, and will be configured with either Apache Mesos or Docker Swarm.
Create SSH Keys with Putty
Browse to this URL to generate an SSH public Key:
- Download PuttyGen Windows installer from here
- Start the PuTTYgen utility, by double-clicking on its .exe file
- For Type of key to generate, select SSH-2 RSA
- In the Number of bits in a generated key field, specify either 2048 or 4096 (increasing the bits makes it harder to crack the key by brute-force methods)
- Click the Generate button
- Move your mouse pointer around in the blank area of the Key section, below the progress bar (to generate some randomness) until the progress bar is full
- A private/ public key pair has now been generated
- In the Key comment field, enter any comment you’d like, to help you identify this key pair, later (e.g. your e-mail address; home; office; etc.) — the key comment is particularly useful in the event you end up creating more than one key pair;
- Optional: Type a passphrase in the Key passphrase field & re-type the same passphrase in theConfirm passphrase field (if you would like to use your keys for automated processes, however, you should not create a passphrase);
- Click the Save public key button & choose whatever filename you’d like (some users create a folder in their computer named my_keys)
- Click the Save private key button & choose whatever filename you’d like (you can save it in the same location as the public key, but it should be a location that only you can access and that you will NOT lose! If you lose your keys and have disabled username/password logins, you will no longer be able log in!)
- Right-click in the text field labeled Public key for pasting into OpenSSH authorized_keys fileand choose Select All
- Right-click again in the same text field and choose Copy
- NOTE: PuTTY and OpenSSH use different formats for public SSH keys. If the SSH Key you copied starts with “—- BEGIN SSH2 PUBLIC KEY …”, it is in the wrong format. Be sure to follow the instructions carefully. Your key should start with “ssh-rsa AAAA ….”
Steps to create Azure Container Service (ACS) using Docker Swarm on Azure Portal
- Browse to the following URL containing the Docker Swarm ACS template: https://github.com/Azure/azure-quickstart-templates/tree/master/101-acs-swarm
- Click ‘Deploy to Azure’ button at the bottom of the template.
- Create a new Resource Group or use existing:
- in a few minutes while the deployment is on, you may see the following resources already created in the resource group:
- For me, the creation took around 11 minutes.
Next – Connect with the ACS Cluster
The Swarm cluster deployed by Azure Container Service exposes REST endpoints, but these endpoints are not open to the outside world. So we need to create an SSH tunnel so we can run commands against the cluster endpoints and view the cluster UI through a browser on our own system. This SSH tunnel can be created from a Linux, OSX, or a Windows system.
Create an SSH tunnel to connect to an ACS cluster on Windows
We can create an SSH tunnel on Windows in many ways, however we will be using Putty in our case.
- Download and install Putty from here if not already installed.
- On the Azure Portal, click on the Swarm-master virtual machine(s) , to explore its settings. In my case a public IP/DNS Name was not enabled.
- Go to Settings –> Network Interfaces -> Settings to enable the Public IP address
- Once a public IP address is assigned, you may open the Public IP settings to also assign a DNS name:
- Once done, copy the DNS Name
- Next, in Putty client, enter the copied host name that is comprised of the cluster’s admin user name and the public DNS name of the master VM in the cluster. The Host Name will look like this,
adminuser@PublicDNSName. Enter 2200 for the Port.
- Next, on the left Category menu, expand Connection ->SSH -> Auth. Click Browse and select the path where you saved the Private SSH key earlier.
- Next, in the lefy Category menu, select
Tunnels(under SSH) and
configurethe following forwarded ports: – Source Port: 2375 for Swarm- Destination: localhost:2375 (for Swarm)
- Click Add.
- When complete, save the connection configuration, and click Open to connect the putty session. When connected, the port configuration can be seen in the Putty event log.
- When the tunnel has been configured for Docker Swarm, the Swarm cluster can be accessed through the Docker CLI. You will first need to configure a Windows Environmental variable named
DOCKER_HOSTwith a value of
- Click Yes on the security Alert:
- Enter the set passphrase earlier (if setup earlier) at the passphrase prompt and press Enter.
- You are now logged in to the Swarm master.
- Check the availability by typing: