Using Azure Container Service (ACS) on Azure

5-DuringCreation

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 :

  1. DCOS Marathon or DCOS Chronos framework for automation on
  2. 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:

  1. Download PuttyGen Windows installer from here
  2. Start the PuTTYgen utility, by double-clicking on its .exe file
  3. For Type of key to generate, select SSH-2 RSA1a-PuttyGen1.PNG
  4. 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)
  5. Click the Generate button
  6. 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
  7. 1a-PuttyGen3
  8. A private/ public key pair has now been generated1a-PuttyGen4
  9. 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;
  10. 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);
  11. Click the Save public key button & choose whatever filename you’d like (some users create a folder in their computer named my_keys)1a-PuttyGen5
  12. 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!)1a-PuttyGen6
  13. Right-click in the text field labeled Public key for pasting into OpenSSH authorized_keys fileand choose Select All
  14. Right-click again in the same text field and choose Copy1a-PuttyGen7
  15. 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

  1. Browse to the following URL containing the Docker Swarm ACS template: https://github.com/Azure/azure-quickstart-templates/tree/master/101-acs-swarm 1-ithubTemplate
  2. Click ‘Deploy to Azure’ button at the bottom of the template.
  3. 2-EditParameters
  4. Create a new Resource Group or use existing:
  5. 3-ParametersPassed
  6. in a few minutes while the deployment is on, you may see the following resources already created in the resource group:
  7. 5-DuringCreation
  8. 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.

  1. Download and install Putty from here if not already installed.
  2. 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.6-SwarmMasterDNSName
  3. Go to Settings –> Network Interfaces -> Settings to enable the Public IP address7EnablePublicIP
  4. Once a public IP address is assigned, you may open the Public IP settings to also assign a DNS name:8-DNSName
  5. Once done, copy the DNS Name 9-CopyDNSName
  6. 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.
  7. 10-ConnectPutty
  8. Next, on the left Category menu, expand Connection ->SSH -> Auth. Click Browse and select the path where you saved the Private SSH key earlier.11-EnterPrivateKey.PNG
  9. Next, in the lefy Category menu, select Tunnels (under SSH) and configure the following forwarded ports: – Source Port:  2375 for Swarm- Destination:  localhost:2375 (for Swarm)12-SwarmPorts
  10. Click Add.
  11. 13-PortsAdded.PNG
  12. 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.
  13. 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_HOST with a value of :2375.
  14. Click Yes on the security Alert:14-SecurityAlert
  15. Enter the set passphrase earlier (if setup earlier) at the passphrase prompt and press Enter.15-enterPassphrase
  16. You are now logged in to the Swarm master.16-LoggedInSwarmMaster
  17. Check the availability by typing:

    >docker ps

    >docker images

17-DockerPS

Cheers!

2 thoughts on “Using Azure Container Service (ACS) on Azure”

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s