Overview 🔗︎

Azure Kubernetes Service (AKS) is the managed Kubernetes offering from Microsoft. It offers serverless Kubernetes and integration with a few other Azure services.

This guide will lead you through the process of launching an AKS cluster on Microsoft Azure with Banzai Cloud Pipeline.

You may want to try PKE on Azure, which is based on Banzai Cloud’s CNCF certified Kubernetes distribution.

Prerequisites 🔗︎

  • Azure credentials
  • Banzai CLI tool authenticated against the Pipeline instance

Create an Azure secret 🔗︎

To access resources on Microsoft Azure the appropriate credentials need to be registered in the Banzai Cloud Pipeline’s secret store. (This secret will be referenced later on instead of passing the credentials around.)

Follow this guide to create Azure credentials.

The following values are needed for the secret:

  • Azure Subscription ID
  • Azure Tenant ID
  • Azure Client ID
  • Azure Client Secret

You can create the secret with the following command (replace the values in the mustache brackets):

banzai secret create <<EOF
{
    "name": "my-aks-secret",
    "type": "azure",
    "values": {
        "AZURE_SUBSCRIPTION_ID": "{{azure-subscription-id}}",
        "AZURE_TENANT_ID": "{{azure-tenant-id}}",
        "AZURE_CLIENT_ID": "{{azure-client-id}}",
        "AZURE_CLIENT_SECRET": "{{azure-client-secret}}"
    }
}
EOF

Creating a simple AKS cluster interactively 🔗︎

To create a new cluster interactively, issue the following command in the command line:

banzai cluster create

The tool will ask for some details interactively. For now, skip loading the options from file by pressing Return:

? Load a JSON or YAML file: [? for help] (skip)

Select aks as the provider:

? Provider:  [Use arrows to move, type to filter, ? for more help]
> aks
  eks
  gke
  pke-on-aws
  pke-on-azure

Select the secret you created for managing AKS clusters on Azure from the list.

? Secret:  [Use arrows to move, type to filter, ? for more help]
> my-aks-secret
  my-azure-pke-secret
  tims-azure-secret

Give your cluster a unique name or accept the randomly generated name:

? Cluster name: (banzai-cloud15457) my-aks-cluster1

Now the tool will show you the current state of the cluster creation request based on your previous answers:

The current state of the request:

{
  "cloud": "azure",
  "location": "westus2",
  "name": "my-aks-cluster1",
  "properties": {
    "aks": {
      "kubernetesVersion": "",
      "nodePools": null,
      "resourceGroup": ""
    }
  },
  "scaleOptions": {
    "enabled": false
  },
  "secretName": "my-aks-secret",
}

If you want, the tool will now give you the opportunity to edit the request in your default text editor:

? Do you want to edit the cluster request in your text editor? (y/N)

If you’re satisfied, confirm the creation of the cluster:

? Do you want to CREATE the cluster "my-azure-pke-cluster1" now? (y/N)

Creating AKS clusters on Azure from file 🔗︎

For more control over the cluster’s parameters the CLI tool provides the option to load them from a file whose content resembles the request above. You can load the file either by typing its file system path in interactive mode:

? Load a JSON or YAML file: [? for help] (skip) path/to/my/request/file.json

By specifying it as a flag to the command:

banzai cluster create -f path/to/my/request/file.json

Or, you can pass it through the standard input:

cat path/to/my/request/file.json | banzai cluster create

Which also gives you the possibility to create the request as a here-document:

banzai cluster create <<EOF
{
  ...
}
EOF
In the rest of this guide, we’ll use here-documents for the sake of simplicity and easier copy-pasting.

Creating a single node cluster 🔗︎

banzai cluster create <<EOF
{
  "cloud": "azure",
  "location": "westus2",
  "name": "my-aks-cluster2",
  "scaleOptions": {
    "enabled": false
  },
  "secretName": "my-aks-secret",
  "properties": {
    "aks": {
      "resourceGroup": "my-resource-group",
      "kubernetesVersion": "1.13.10",
      "nodePools": {
        "pool1": {
          "count": 1,
          "autoscaling": false,
          "instanceType": "Standard_B2s",
          "minCount": 1,
          "maxCount": 1
        }
      }
    }
  }
}
EOF

Creating a cluster with multiple workers 🔗︎

To increase the number of workers, you can start with the previous example. You only have to change the nodePools definition.

count defines the initial number of nodes to start, while minCount and maxCount define the range of within the pool will be scaled if autoscaling is enabled. You can of course add multiple node pools to launch a heterogenous cluster.

Checking the status of the cluster 🔗︎

To check the status of the cluster, run the following command:

banzai cluster get "<cluster-name>"

Once the cluster is ready, you can try to run some simple commands. banzai cluster shell executes a shell within the context of the selected cluster. If you type a command in the shell opened, or pass arguments to it, it will be executed in a prepared environment. For example, you can list the nodes of the cluster using the original kubectl command by running:

banzai cluster shell --cluster-name "<cluster-name>" -- kubectl get nodes

Further steps 🔗︎

If you are happy with the results, go on with the Deploying workload guide to learn about the basic features of a cluster.