Azure Container Service provides rapid deployment of popular open-source container clustering and orchestration solutions. By using Azure Container Service, you can deploy DC/OS and Docker Swarm clusters with Azure Resource Manager templates or the Azure portal. You deploy these clusters by using Azure Virtual Machine Scale Sets, and the clusters take advantage of Azure networking and storage offerings. To access Azure Container Service, you need an Azure subscription. If you don't have one, then you can sign up for a free trial.
This document walks you through deploying an Azure Container Service cluster by using the Azure portal, the Azure command-line interface (CLI), and the Azure PowerShell module.
Sign in to the Azure portal, select New, and search the Azure Marketplace for Azure Container Service.
Select Azure Container Service, and click Create.
Enter the following information:
- User name: This is the user name that will be used for an account on each of the virtual machines and virtual machine scale sets in the Azure Container Service cluster.
- Subscription: Select an Azure subscription.
- Resource group: Select an existing resource group, or create a new one.
- Location: Select an Azure region for the Azure Container Service deployment.
- SSH public key: Add the public key that will be used for authentication against Azure Container Service virtual machines. It is very important that this key contains no line breaks, and that it includes the 'ssh-rsa' prefix and the 'username@domain' postfix. It should look something like the following: ssh-rsa AAAAB3Nz...<...>...UcyupgH azureuser@linuxvm. For guidance on creating Secure Shell (SSH) keys, see the Linux and Windows articles.
Click OK when you're ready to proceed.
Select an Orchestration type. The options are:
- DC/OS: Deploys a DC/OS cluster.
- Swarm: Deploys a Docker Swarm cluster.
- Kubernetes: Deploys a Docker Kubernetes cluster.
Click OK when you're ready to proceed.
Enter the following information:
- Master count: The number of masters in the cluster.
- Agent count: For Docker Swarm, this will be the initial number of agents in the agent scale set. For DC/OS, this will be the initial number of agents in a private scale set. Additionally, a public scale set is created, which contains a predetermined number of agents. The number of agents in this public scale set is determined by how many masters have been created in the cluster--one public agent for one master, and two public agents for three or five masters.
- Agent virtual machine size: The size of the agent virtual machines.
- DNS prefix: A world unique name that will be used to prefix key parts of the fully qualified domain names for the service.
Click OK when you're ready to proceed.
Click OK after service validation has finished.
Click Create to start the deployment process.
If you've elected to pin the deployment to the Azure portal, you can see the deployment status.
When the deployment has completed, the Azure Container Service cluster is ready for use.
To create an instance of Azure Container Service by using the command line, you need an Azure subscription. If you don't have one, then you can sign up for a free trial. You also need to have installed and configured the Azure CLI.
To deploy a DC/OS or Docker Swarm cluster, select one of the following templates from GitHub. Note that both of these templates are the same, with the exception of the default orchestrator selection.
Next, make sure that the Azure CLI has been connected to an Azure subscription. You can do this by using the following command:
azure account show
If an Azure account is not returned, use the following command to sign the CLI in to Azure.
azure login -u user@domain.com
Next, configure the Azure CLI tools to use Azure Resource Manager.
azure config mode arm
Create an Azure resource group and Container Service cluster with the following command, where:
- RESOURCE_GROUP is the name of the resource group that you want to use for this service.
- LOCATION is the Azure region where the resource group and Azure Container Service deployment will be created.
- TEMPLATE_URI is the location of the deployment file. Note that this must be the Raw file, not a pointer to the GitHub UI. To find this URL, select the azuredeploy.json file in GitHub, and click the Raw button.
[AZURE.NOTE] When you run this command, the shell will prompt you for deployment parameter values.
azure group create -n RESOURCE_GROUP DEPLOYMENT_NAME -l LOCATION --template-uri TEMPLATE_URI
This version of the command requires you to define parameters interactively. If you want to provide parameters, such as a JSON-formatted string, you can do so by using the -p
switch. For example:
azure group deployment create RESOURCE_GROUP DEPLOYMENT_NAME --template-uri TEMPLATE_URI -p '{ "param1": "value1" … }'
Alternatively, you can provide a JSON-formatted parameters file by using the -e
switch:
azure group deployment create RESOURCE_GROUP DEPLOYMENT_NAME --template-uri TEMPLATE_URI -e PATH/FILE.JSON
To see an example parameters file named azuredeploy.parameters.json
, look for it with the Azure Container Service templates in GitHub.
You can also deploy an Azure Container Service cluster with PowerShell. This document is based on the version 1.0 Azure PowerShell module.
To deploy a DC/OS or Docker Swarm cluster, select one of the following templates. Note that both of these templates are the same, with the exception of the default orchestrator selection.
Before creating a cluster in your Azure subscription, verify that your PowerShell session has been signed in to Azure. You can do this with the Get-AzureRMSubscription
command:
Get-AzureRmSubscription
If you need to sign in to Azure, use the Login-AzureRMAccount
command:
Login-AzureRmAccount
If you're deploying to a new resource group, you must first create the resource group. To create a new resource group, use the New-AzureRmResourceGroup
command, and specify a resource group name and destination region:
New-AzureRmResourceGroup -Name GROUP_NAME -Location REGION
After you create a resource group, you can create your cluster with the following command. The URI of the desired template will be specified for the -TemplateUri
parameter. When you run this command, PowerShell will prompt you for deployment parameter values.
New-AzureRmResourceGroupDeployment -Name DEPLOYMENT_NAME -ResourceGroupName RESOURCE_GROUP_NAME -TemplateUri TEMPLATE_URI
If you're familiar with PowerShell, you know that you can cycle through the available parameters for a cmdlet by typing a minus sign (-) and then pressing the TAB key. This same functionality also works with parameters that you define in your template. As soon as you type the template name, the cmdlet fetches the template, parses the parameters, and adds the template parameters to the command dynamically. This makes it very easy to specify the template parameter values. And, if you forget a required parameter value, PowerShell prompts you for the value.
Below is the full command, with parameters included. You can provide your own values for the names of the resources.
New-AzureRmResourceGroupDeployment -ResourceGroupName RESOURCE_GROUP_NAME-TemplateURI TEMPLATE_URI -adminuser value1 -adminpassword value2 ....
Now that you have a functioning cluster, see these documents for connection and management details: