First encounters with creating a Managed Kubernetes Cluster (AKS) on Azure

Yesterday Microsoft announced in this blogpost thatr the public preview for a Managed Kubernetes Cluster (AKS) is now available. I directly wanted to test this and followed the steps in the blog. They work but I ran into a few tiny errors which were easy to solve if you know where to look.

  • First thing you need to do is to download the latest version of the Azure CLI 2.0 (> 2.0.20)
  • Then create a resource group in westus2 using this command. Other regions won’t work for now.
    az group create --name resourcegroupname --location westus2

    Why? I first created one in westeurope and when I ran the cluster create command (see next bullet) I got this message

    The provided location 'westeurope' is not available for resource type '
    Microsoft.ContainerService/managedClusters'. List of available 
    regions for the resource type is 'ukwest,westus2'.

    So I created one close by in ukwest but that did not work later on. See next bullets..

  • Run the cluster create command
    az aks create –n myCluster –g myResourceGroup
  • Then after running the cluster create statement I got this error
    The subscription is not registered for the resource type 
    'managedClusters'. Please re-register for this provider in order to 
    have access to this resource type.

    This means that the Resource Provider to create this cluster is not registered or needs to be re-registered

  • Re-Register all Container Resource Providers in the Azure portal. Navigate to the Azure Portal, to the Subscriptions. Select the subscription that you want to use for the AKS cluster. Choose [Resource Providers] from the blade and search for Container. Register or Re-Register all of them.

    AKS

  • After trying again in my ukwest Resource group (I chose this first instead of westus2) . I got this error.
    The VM size of Agent is not allowed in your subscription in location
     'ukwest'. Agent VM size 'Standard_D2_v2' is available in locations: 
    brazilsouth,canadacentral,centralindia,centralus,centraluseuap,eastus,
    eastus2,eastus2euap,japaneast,southcentralus,southeastasia,southindia,
    westcentralus,westeurope,westus2.

    This basically means that the only applicable region now is westus2.

  • After creating the resource group in westus and registering the Resource Providers the command worked and my cluster spinned up!
  • When I tried to get the credentials from the cluster by running
    az aks get-credentials -g resourcegroup -n clustername

    I got an Permission Denied Error from python. It could not write the KubeCtl config

    [Errno 13] Permission denied: 'C:\\Users\\rvano\\AppData\\Local\\Temp\\tmp6bm3qkq6'
    Traceback (most recent call last):
     File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\main.py", line 36, in main
     cmd_result = APPLICATION.execute(args)
     File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\core\application.py", line 212, in execute
     result = expanded_arg.func(params)
     File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\core\commands\__init__.py", line 377, in __call__
     return self.handler(*args, **kwargs)
     File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\core\commands\__init__.py", line 620, in _execute_command
     reraise(*sys.exc_info())
     File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\six.py", line 693, in reraise
     raise value
     File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\core\commands\__init__.py", line 602, in _execute_command
     result = op(client, **kwargs) if client else op(**kwargs)
     File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\command_modules\acs\custom.py", line 1288, in aks_get_credentials
     merge_kubernetes_configurations(path, additional_file.name)
     File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\command_modules\acs\custom.py", line 829, in merge_kubernetes_configurations
     with open(addition_file) as stream:
    PermissionError: [Errno 13] Permission denied: 'C:\\Users\\rvano\\AppData\\Local\\Temp\\tmp6bm3qkq6'

After some trying I could not really fix it. I have to dive in to that at a later time.  Instead I used the Ubuntu SubSystem for Windows 

I Installed the Azure CLI 2.0 there as well and after logging in ran the same command. There (on linux) it worked. It generated a config file in the .kube folder in my home directory. By using the command

cat /home/user/.kube/config

It printed the config on my command line. I copied that to my config file in my c:\users\username\AppData\.kube\config file and tried to get the nodes from my cluster after that

kubectl get nodes

Now that the config is filled correctly, it works!

Trackbacks/Pingbacks

  1. KubeWeekly #110 – KubeWeekly - November 1, 2017

    […] First encounters with creating a Managed Kubernetes Cluster (AKS) on Azure […]

%d bloggers like this: