Overview

Banzai Cloud Pipeline Kubernetes Engine (PKE) is a simple, secure and powerful CNCF certified Kubernetes distribution, the preferred Kubernetes run-time of the Pipeline platform.

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

Prerequisites

  • Azure credentials
  • an Azure resource group
  • 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-azure-pke-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 PKE cluster on Azure 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 pke-on-azure as the provider:

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

Select the secret you created for managing PKE 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-cloud63941) my-azure-pke-cluster1

Select the resource group to place your cluster’s resources in from the list.

? Resource group:  [Use arrows to move, type to filter]
  alpha-resource-group
  default-rg
  johns-resources
> pipeline-test
  project-banzai
  testresourcegroup

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:

{
  "kubernetes": {
    "cri": {},
    "network": {},
    "rbac": true,
    "version": "1.14.2"
  },
  "location": "westus2",
  "name": "my-azure-pke-cluster1",
  "network": {},
  "nodepools": [
    {
      "count": 1,
      "instanceType": "Standard_D2s_v3",
      "maxCount": 1,
      "minCount": 1,
      "name": "master",
      "roles": [
        "master",
        "worker"
      ],
      "subnet": {}
    }
  ],
  "resourceGroup": "pipeline-test",
  "scaleOptions": {
    "enabled": false
  },
  "secretName": "my-azure-pke-secret",
  "type": "pke-on-azure"
}

If you want, the tool will now give you the opportunity to edit the request in your favorite 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 PKE 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

The quantity of master and worker nodes depends on the nodepools definition in the request. If the cluster has master nodes only, they will also accept workload. This makes it possible to run single-node clusters for development purposes.

banzai cluster create <<EOF
{
  "kubernetes": {
    "cri": {},
    "network": {},
    "rbac": true,
    "version": "1.14.2"
  },
  "location": "westus2",
  "name": "my-azure-pke-cluster2",
  "network": {},
  "nodepools": [
    {
      "count": 1,
      "instanceType": "Standard_D2s_v3",
      "maxCount": 1,
      "minCount": 1,
      "name": "master",
      "roles": [
        "master"
      ],
      "subnet": {}
    }
  ],
  "resourceGroup": "pipeline-test",
  "scaleOptions": {
    "enabled": false
  },
  "secretName": "my-azure-pke-secret",
  "type": "pke-on-azure"
}
EOF

Creating a highly available cluster

The following example will create a cluster with three master nodes to achieve high availability.

Additionally, multiple heterogenous node pools are defined.

banzai cluster create <<EOF
{
  "kubernetes": {
    "cri": {},
    "network": {},
    "rbac": true,
    "version": "1.14.2"
  },
  "location": "westus2",
  "name": "my-azure-pke-cluster3",
  "network": {},
  "nodepools": [
    {
      "count": 3,
      "instanceType": "Standard_D2s_v3",
      "maxCount": 3,
      "minCount": 3,
      "name": "master",
      "roles": [
        "master"
      ],
      "subnet": {}
    },
    {
      "count": 1,
      "instanceType": "Standard_B2s",
      "maxCount": 1,
      "minCount": 1,
      "name": "medium-worker",
      "roles": [
        "worker"
      ],
      "subnet": {}
    },
    {
      "count": 2,
      "instanceType": "Standard_A2_v2",
      "maxCount": 2,
      "minCount": 2,
      "name": "small-worker",
      "roles": [
        "worker"
      ],
      "subnet": {}
    },
    {
      "count": 1,
      "instanceType": "Standard_D2s_v3",
      "maxCount": 1,
      "minCount": 1,
      "name": "large-worker",
      "roles": [
        "worker"
      ],
      "subnet": {}
    }
  ],
  "resourceGroup": "pipeline-test",
  "scaleOptions": {
    "enabled": false
  },
  "secretName": "my-azure-pke-secret",
  "type": "pke-on-azure"
}
EOF

Creating a multi-zone cluster in an existing network

This example shows how to create a cluster by specifying an existing virtual network. Also, worker nodes are created in specific availability zones.

banzai cluster create <<EOF
{
  "kubernetes": {
    "cri": {},
    "network": {},
    "rbac": true,
    "version": "1.14.2"
  },
  "location": "westus2",
  "name": "my-azure-pke-cluster4",
  "network": {
    "name": "my-virtual-network",
  },
  "nodepools": [
    {
      "count": 1,
      "instanceType": "Standard_D2s_v3",
      "maxCount": 1,
      "minCount": 1,
      "name": "master",
      "roles": [
        "master"
      ],
      "subnet": {
        "name": "my-subnet",
      },
    },
    {
      "count": 1,
      "instanceType": "Standard_B2s",
      "maxCount": 1,
      "minCount": 1,
      "name": "worker-in-z1",
      "roles": [
        "worker"
      ],
      "subnet": {
        "name": "my-subnet",
      },
      "zones": ["1"]
    },
    {
      "count": 2,
      "instanceType": "Standard_A2_v2",
      "maxCount": 2,
      "minCount": 2,
      "name": "worker-in-z2",
      "roles": [
        "worker"
      ],
      "subnet": {
        "name": "my-subnet",
      },
      "zones": ["2"]
    }
  ],
  "resourceGroup": "pipeline-test",
  "scaleOptions": {
    "enabled": false
  },
  "secretName": "my-azure-pke-secret",
  "type": "pke-on-azure"
}
EOF

Checking the status of the cluster

You can check the status of the cluster creation with the following command:

banzai cluster get "my-azure-pke-cluster1"  # don't forget to change the name of the cluster if necessary

Once the cluster is ready, you can try it with 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 it as arguments, it will be executed in a prepared environment. For example, you can list the nodes of the cluster using the original kubectl command:

banzai cluster shell -- 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.