{"id":47296,"date":"2017-04-05T18:52:08","date_gmt":"2017-04-05T13:22:08","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=47296"},"modified":"2017-04-06T09:53:10","modified_gmt":"2017-04-06T04:23:10","slug":"introduction-to-azure-container-service","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/introduction-to-azure-container-service\/","title":{"rendered":"Introduction to Azure Container Service"},"content":{"rendered":"<p>Azure Container Service (ACS) provided by Azure helps to simplify the management of <a title=\"Docker DevOps\" href=\"http:\/\/www.tothenew.com\/devops-chef-puppet-docker\">Docker<\/a> clusters for running containerized applications. ACS supports 3 Orchestrators: <a href=\"https:\/\/dcos.io\/\">DC\/OS<\/a> with <a href=\"https:\/\/dcos.io\/docs\/1.7\/usage\/tutorials\/marathon\/marathon101\/\">Marathon<\/a>, <a href=\"https:\/\/github.com\/docker\/swarm\">Docker Swarm<\/a>, and <a href=\"https:\/\/kubernetes.io\/\">Kubernetes<\/a>. We are using Docker Swarm in this article\u00a0for the demonstration and assuming that readers of this blog are familiar with containerization technologies such as\u00a0Docker Swarm and a basic understanding of Azure portal.<\/p>\n<h1>Creating Docker cluster with ACS:<\/h1>\n<p><strong>1. Create a container service:<br \/>\n<\/strong>In the Azure portal, go to the Azure container services.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-47298\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/01.selectservice.png\" alt=\"01.selectservice\" width=\"524\" height=\"244\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/01.selectservice.png 524w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/01.selectservice-300x139.png 300w\" sizes=\"(max-width: 524px) 100vw, 524px\" \/><\/p>\n<p><strong>2. Basic Settings:<\/strong><\/p>\n<p>Add a new container service and provide the basic settings. Choose Swarm for Orchestrator. Chose your subscription and, create a new resource group. You can also change location, but make sure that ACS is available in the region of your choice.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-47350\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/02.basic_settings1.png\" alt=\"02.basic_settings\" width=\"640\" height=\"377\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/02.basic_settings1.png 640w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/02.basic_settings1-300x176.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/02.basic_settings1-624x367.png 624w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><strong>3. Master Configuration:<\/strong><br \/>\nFor master configuration, chose a DNS name, master credentials such as username, public key, and the master count i.e. the number of masters for the cluster.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-47351\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/03.masterconfig.png\" alt=\"03.masterconfig\" width=\"643\" height=\"432\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/03.masterconfig.png 643w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/03.masterconfig-300x201.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/03.masterconfig-624x419.png 624w\" sizes=\"(max-width: 643px) 100vw, 643px\" \/><\/p>\n<p><strong>4. Agent Configuration:<\/strong><br \/>\nChose the agent count and select the machine size for Agent instance.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-47352\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/04.agentconfig.png\" alt=\"04.agentconfig\" width=\"648\" height=\"305\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/04.agentconfig.png 648w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/04.agentconfig-300x141.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/04.agentconfig-624x293.png 624w\" sizes=\"(max-width: 648px) 100vw, 648px\" \/><\/p>\n<p>You can review the settings before launching the container service.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-47353\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/05.summary.png\" alt=\"05.summary\" width=\"642\" height=\"415\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/05.summary.png 642w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/05.summary-300x193.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/05.summary-624x403.png 624w\" sizes=\"(max-width: 642px) 100vw, 642px\" \/><\/p>\n<p>The resource group created with this container service will have many items such as the master, agent, storage accounts, load balancer, public IP addresses, virtual network, and virtual interfaces.<\/p>\n<p>Out of these resources created by the container service, we are interested in the container service &#8220;containerservice-rg01&#8221;. Click on it to see the overview of service. Note down the master FQDN, which will be used to connect to the container service.<\/p>\n<p><strong>5. Create SSH Tunnel:<\/strong><br \/>\nCreate an SSH tunnel to the container master by executing the following command:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-47355\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/07.createTunnel.png\" alt=\"07.createTunnel\" width=\"500\" height=\"39\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/07.createTunnel.png 500w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/07.createTunnel-300x23.png 300w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/p>\n<p>Here, &#8220;demoazure&#8221; is the key file name that we have used for launching the container service. Going forward, export the DOCKER_HOST variable with the following command:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-47357\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/08.exportDockerHost.png\" alt=\"08.exportDockerHost\" width=\"224\" height=\"32\" \/><\/p>\n<p>This command will ensure that the <a href=\"http:\/\/www.tothenew.com\/blog\/docker-monitoring-using-ruxit\/\">docker container<\/a> that you create will be managed by the tunneled ACS master. The swarm cluster that ACS has created for us uses consul for service discovery.<\/p>\n<p><strong>6. Create Nginx Container:<\/strong><br \/>\nNow that the setup is complete, we can proceed and create a container. As a demo, we will create a <a href=\"http:\/\/www.tothenew.com\/blog\/dockerizing-nginx-and-ssh-using-supervisord\/\">Nginx container<\/a>. However, it is advisable to check if any container is already running in the cluster.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-47358\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/09.checkContainers.png\" alt=\"09.checkContainers\" width=\"1005\" height=\"52\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/09.checkContainers.png 1005w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/09.checkContainers-300x15.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/09.checkContainers-624x32.png 624w\" sizes=\"(max-width: 1005px) 100vw, 1005px\" \/><\/p>\n<p>Create the Nginx container with port 80 exposed:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-47359\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/10.createNginxContainer.png\" alt=\"10.createNginxContainer\" width=\"777\" height=\"134\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/10.createNginxContainer.png 777w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/10.createNginxContainer-300x51.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/10.createNginxContainer-624x107.png 624w\" sizes=\"(max-width: 777px) 100vw, 777px\" \/><\/p>\n<p><strong>7. Test Application:<\/strong><br \/>\nNow that our container is running, we need the endpoint for our application (Nginx here). In the Azure console, select the agent load balancer:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-47360\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/11.selectAgentLB-1024x462.png\" alt=\"11.selectAgentLB\" width=\"625\" height=\"281\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/11.selectAgentLB-1024x462.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/11.selectAgentLB-300x135.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/11.selectAgentLB-624x281.png 624w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/11.selectAgentLB.png 1284w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<p>Note down the public IP address for this load balancer:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-47361\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/12.agentLBIP-1024x267.png\" alt=\"12.agentLBIP\" width=\"625\" height=\"162\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/12.agentLBIP-1024x267.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/12.agentLBIP-300x78.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/12.agentLBIP-624x162.png 624w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/12.agentLBIP.png 1169w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<p>This load balancer created by ACS already consists of three rules corresponding to port 80, 443 and 8080. In case you have deployed an application which uses any other port, you will need to add the required rule\u00a0<span style=\"background-color: #f5f6f5;\">manually.<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-47362\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/13.lbRules-1024x463.png\" alt=\"13.lbRules\" width=\"625\" height=\"282\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/13.lbRules-1024x463.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/13.lbRules-300x135.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/13.lbRules-624x282.png 624w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/13.lbRules.png 1122w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<p>Now hit the IP address, and you will have your Nginx application running on the ACS cluster.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-47363\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/14.nginxWelcomePage.png\" alt=\"14.nginxWelcomePage\" width=\"716\" height=\"381\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/03\/14.nginxWelcomePage.png 716w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/14.nginxWelcomePage-300x159.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/03\/14.nginxWelcomePage-624x332.png 624w\" sizes=\"(max-width: 716px) 100vw, 716px\" \/><\/p>\n<p>Hope this blog was helpful. Do let us know if the comments below if you are able to follow the mentioned steps and use Microsoft Azure container service to deploy your stack.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Azure Container Service (ACS) provided by Azure helps to simplify the management of Docker clusters for running containerized applications. ACS supports 3 Orchestrators: DC\/OS with Marathon, Docker Swarm, and Kubernetes. We are using Docker Swarm in this article\u00a0for the demonstration and assuming that readers of this blog are familiar with containerization technologies such as\u00a0Docker Swarm [&hellip;]<\/p>\n","protected":false},"author":931,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":3},"categories":[4308,2348,1],"tags":[3457,2414,4143,1883,2651,2372,3965,1336],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/47296"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/931"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=47296"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/47296\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=47296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=47296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=47296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}