Skip to content

Latest commit

 

History

History
274 lines (157 loc) · 9.86 KB

File metadata and controls

274 lines (157 loc) · 9.86 KB

Module 4: Creating Managed Server Applications in Azure

Lab Answer Key: Deploying Managed Server Workloads to Azure

Before we start

  1. Ensure that you are logged in to your Windows 10 Virtual Machine using the following credentials:

    • Username: Admin

    • Password: Pa55w.rd

  2. Observe the Taskbar located at the bottom of your Windows 10 desktop. The Taskbar contains the icons for the common applications we will use in the labs:

    Note: You can also find shortcuts to these applications on the Desktop and in the Start Menu.

Exercise 1: Create Azure Container Service (ACS) Cluster

Task 1: Open the Azure Portal

  1. On the Taskbar, click the Microsoft Edge icon.

  2. In the open browser window, navigate to the Azure Portal (https://portal.azure.com).

  3. Enter the email address of your Microsoft account.

  4. Click the Next button.

  5. Enter the password for your Microsoft account.

  6. Click the Sign in button.

Task 2: Create Docker Swarm ACS Cluster using Cloud Shell

  1. At the top of the portal, click the Cloud Shell icon to open a new shell instance.

  2. In the Cloud Shell command prompt at the bottom of the portal, type in the following command and press Enter to create a new Resource Group:

    az group create --name MOD04ACSC --location eastus
    
  3. Type in the following command and press Enter to create a new Docker Swarm cluster with a single agent and automatically generated SSH keys:

    az acs create --name DockerSwarmCluster --orchestrator-type Swarm --resource-group MOD04ACSC --agent-count 1 --generate-ssh-keys
    
  4. Wait for the ACS creation operation to complete.

    Note: This operation can take up to five minutes.

Task 3: Configure Tunnel Connection to ACS Cluster using SSH

  1. Type in the following command and press Enter to get a list of Public IP Addresses in your Resource Group that contain the term master in their name:

    az network public-ip list --resource-group MOD04ACSC --query "[?contains(name, 'master')].{Name:name,IPAddress:ipAddress}" -o table
    
  2. The results of the query will look like this:

    Name                                                      IPAddress
    --------------------------------------------------------  ------------
    swarm-master-ip-dockerswar-mod04acsc-e91967mgmt-1FE2477D  52.170.19.88
    
  3. Record the value of the IPAddress field in the query results. This is the IP Address of your Docker Swarm master.

  4. Type in the following command and press Enter to get a list of Public IP Addresses in your Resource Group that contain the term agent in their name:

    az network public-ip list --resource-group MOD04ACSC --query "[?contains(name, 'agent')].{Name:name,IPAddress:ipAddress}" -o table
    
  5. The results of the query will look like this:

    Name                                                      IPAddress
    --------------------------------------------------------  ------------
    swarm-agent-ip-dockerswar-mod04acsc-e91967agent-1FE2477D  52.170.22.39
    
  6. Record the value of the IPAddress field in the query results. This is the IP Address of your Docker Swarm agent pool.

  7. Type in the following command and press Enter to create a SSH tunnel connection to the Docker Swarm master using the IP Address you recorded earlier:

    ssh -p 2200 -fNL 2375:localhost:2375 azureuser@[Master IP Address]
    

    Make sure you replace the [Master IP Address] placeholder with the actual IP Address of the Docker Swarm master. For example, if your master IP Address is 52.170.19.88, your command will look like this:

    ssh -p 2200 -fNL 2375:localhost:2375 [email protected]
    
  8. You will see a prompt indicating that the authenticity of the host can't be established. Type in yes and press Enter to continue connecting.

Review: In this exercise, you created a new Docker Swarm cluster and connected to that cluster using a SSH tunnel.

Exercise 2: Deploy Docker Image to Azure Container Service (ACS) Cluster

Task 1: Deploy a Basic Docker Image to ACS using Tunnel Connection

  1. Still within the Cloud Shell, type in the following command and press Enter to set an environment variable to make it easier to run docker commands:

    export DOCKER_HOST=:2375
    
  2. Type in the following command and press Enter to validate that docker commands work with your Docker Swarm cluster:

    docker info
    
  3. Type in the following command and press Enter to run the nginx web server in a container within your Docker Swarm cluster:

    docker run -d -p 80:80 --name webserver nginx
    
  4. In a new browser tab, navigate to the *agent pool IP address you copied earlier in this lab.

  5. Observe the nginx web server placeholder webpage.

  6. Close the additional browser tab and return to the browser tab with the Azure Portal currently active.

  7. Returning to the Cloud Shell, type in the following command and press Enter to list all running containers:

    docker ps
    
  8. Type in the following command and press Enter to stop the webserver container:

    docker stop webserver
    
  9. Type in the following command and press Enter to remove the webserver container:

    docker rm webserver
    
  10. Type in the following command and press Enter to list all running containers:

    docker ps
    
  11. Close the Cloud Shell prompt at the bottom of the portal.

Review: In this exercise, you deployed a Docker image (nginx) to the Azure Container Services' hosted Docker Swarm.

Exercise 3: Deploy Docker Image to Azure Container Instance

Task 1: Create Azure Container Instance with Docker Hub Image

  1. On the left side of the portal, click the Create a resource link.

  2. At the top of the New blade, locate the Search the Marketplace field.

  3. Enter the text Container Instance into the search field and press Enter.

  4. In the Everything search results blade, select the Azure Container Instances result.

  5. In the Azure Container Instances blade, click the Create button.

  6. In the Create Azure Container Instance blade, select the Basics option to begin configuring the container instance by performing the following actions:

    a. In the Container Name field, enter the value webapplication.

    a. In the Container image type section, select the Public option.

    a. In the Container image field, enter the value microsoft/aci-helloworld.

    a. Leave the Subscription field set to its default value.

    a. In the Resource group section, select the Create new option.

    a. In the Resource group section, enter the value MOD04ACIN into the empty field..

    a. In the Location field, select the East US location.

    a. Click the OK button.

  7. The Create Azure Container Instance blade will move on to the Configuration option, continue configuring the container instance by performing the following actions:

    a. In the OS Type section, select the Linux option.

    a. In the Number of cores list, select the 2 option.

    a. In the Memory (GB) field, enter the value 4.

    a. In the Public IP address section, select the Yes option.

    a. In the Port field, enter the value 80.

    a. Click the OK button.

  8. The Create Azure Container Instance blade will move on to the Summary option. Confirm the details of your new Azure Container Instance and click the OK button.

  9. Wait for the creation task to complete before moving on with this lab.

Task 2: Validate Container Deployment

  1. On the left side of the portal, click the Resource groups link.

  2. In the Resource groups blade, locate and select the MOD04ACIN Resource Group link.

  3. In the MOD04ACIN blade, select the Container Group you recently created.

  4. In the Container group blade, locate the IP address field at the top of the blade. Copy the value of this field.

  5. In a new browser tab, navigate to the IP address you copied in the previous step.

  6. Observe the home page of the running Node.js web application.

  7. Close the additional browser tab and return to the browser tab with the Azure Portal currently active.

Review: In this exercise, you used an Azure Container Instance to deploy a single Docker container.

Exercise 4: Cleanup Subscription

Task 1: Open Cloud Shell

  1. At the top of the portal, click the Cloud Shell icon to open a new shell instance.

  2. In the Cloud Shell command prompt at the bottom of the portal, type in the following command and press Enter to list all resource groups in the subscription:

    az group list
    

Task 2: Delete Resource Groups

  1. Type in the following command and press Enter to delete the MOD04ACSC Resource Group:

    az group delete --name MOD04ACSC --no-wait --yes
    
  2. Type in the following command and press Enter to delete the MOD04ACIN Resource Group:

    az group delete --name MOD04ACIN --no-wait --yes
    
  3. Close the Cloud Shell prompt at the bottom of the portal.

Task 3: Close Active Applications

  1. Close the currently running Microsoft Edge application.

Review: In this exercise, you "cleaned up your subscription" by removing the Resource Groups used in this lab.