Daniel's Tech Blog

Cloud Computing, Cloud Native & Kubernetes

Deploying a Kubernetes cluster on Azure Germany via acs-engine

Currently the Azure Container Service is not available in one of the regions of Azure Germany, that supports you creating an Kubernetes cluster in an easy way.

acs-engine00

But do not be afraid. There is a handy tool called the Azure Container Service Engine or short acs-engine available on GitHub to generate the necessary ARM templates for you.

-> https://github.com/Azure/acs-engine

To start with acs-engine, just download the necessary bits for your OS.

-> https://github.com/Azure/acs-engine/releases/latest

In this blog post I am focusing on acs-engine version 0.8.0 for Windows.

Before we are starting with the generation of our ARM templates for the Kubernetes cluster, we will need three things first.

  1. SSH key
  2. Azure AD Service Principal
  3. Kubernetes cluster definition

Generating a SSH key is pretty easy and can be done by following the Azure documentation.

-> https://docs.microsoft.com/en-us/azure/virtual-machines/linux/mac-create-ssh-keys

The next step is to create the necessary Azure AD Service Principal and assign the account with Contributor permissions to the resource group you would like to deploy the Kubernetes cluster in.

-> https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal#create-an-azure-active-directory-application

acs-engine01

Last action item, before we can generate the ARM templates, is to download the standard Kubernetes cluster definition file and modifying it.

-> https://github.com/Azure/acs-engine/blob/master/examples/kubernetes.json

Before we modifying the settings, it is very important to add the location section! Otherwise your Kubernetes cluster will not come up, because the Kubernetes cluster config files will not be generated correctly to leverage Azure Germany. For the location section specify either germanycentral or germanynortheast for the Azure Germany region you prefer.

Then we can start with the modification of the masterProfile, agentPoolProfiles, linuxProfile and servicePrincipalProfile sections.

As an example, have a look at the following Kubernetes cluster definition.

{
    "apiVersion": "vlabs",
    "location": "germanycentral",
    "properties": {
        "orchestratorProfile": {
            "orchestratorType": "Kubernetes"
        },
        "masterProfile": {
            "count": 1,
            "dnsPrefix": "kubernetesmaster",
            "vmSize": "Standard_D2_v2"
        },
        "agentPoolProfiles": [
            {
                "name": "agentpool1",
                "count": 3,
                "vmSize": "Standard_D2_v2",
                "availabilityProfile": "AvailabilitySet"
            }
        ],
        "linuxProfile": {
            "adminUsername": "azureuser",
            "ssh": {
                "publicKeys": [
                    {
                        "keyData": "Enter you SSH key"
                    }
                ]
            }
        },
        "servicePrincipalProfile": {
            "clientId": "Enter AAD Service Principal Application ID",
            "secret": "Enter AAD Service Principal Secret"
        }
    }
}

Copy the Kubernetes cluster definition file kubernetes.json into the acs-engine folder and open a command line or PowerShell window.

acs-engine04

Use the following command in the open command line or PowerShell window to generate the ARM templates.

.\acs-engine.exe generate .\kubernetes.json

acs-engine05

The command places the ARM templates in the  folder _output, if you have not specify any output folder.

Jump into the output folder and kick off the deployment with PowerShell or Azure CLI. See the following PowerShell command for starting the deployment after you successfully logged in to Azure via the Login-AzureRmAccount cmdlet.

New-AzureRmResourceGroupDeployment -ResourceGroupName azurecontainerservice -TemplateParameterFile .\azuredeploy.parameters.json -TemplateFile .\azuredeploy.json -Verbose

The example deployment we are using here needs round about 10 minutes for a successful deployment.

acs-engine02

As you can see the Kubernetes cluster is up and running in Azure Germany and ready to use.

acs-engine03

Finally, use the following guide to get started with your newly deployed Kubernetes cluster on Azure Germany.

-> https://github.com/Azure/acs-engine/blob/master/docs/kubernetes/walkthrough.md

WordPress Cookie Notice by Real Cookie Banner