Prepare to Deploy Management Clusters to Microsoft Azure

This topic explains how to prepare Microsoft Azure for running Tanzu Kubernetes Grid.

If you are installing Tanzu Kubernetes Grid on Azure VMware Solution (AVS), you are installing to a vSphere environment. See Preparing Azure VMware Solution on Microsoft Azure in Prepare a vSphere Management as a Service Infrastructure to prepare your environment and Prepare to Deploy Management Clusters to vSphere to deploy management clusters.

Installation Process Overview

The following diagram shows the high-level steps for installing a Tanzu Kubernetes Grid management cluster on Azure, and the interfaces you use to perform them.

These steps include the preparations listed below plus the procedures described in either Deploy Management Clusters with the Installer Interface or Deploy Management Clusters from a Configuration File.

Process Diagram: Start, Install the Tanzu CLI, Register a TKG App on Azure, Accept the Base Image License. If first deploy and no advanced config options, deploy with installer interface. Else deploy with config file.

General Requirements

  • The Tanzu CLI installed locally. See Install the Tanzu CLI and Other Tools.
  • A Microsoft Azure account with the following:
    • Permissions required to create a service principal and assign the Owner role to it.
      For more information about the roles, see Azure built-in roles.
    • Sufficient VM core (vCPU) quotas for your clusters. A standard Azure account has a quota of 10 vCPU per region.
      Tanzu Kubernetes Grid clusters require 2 vCPU per node, which translates to:
      • Management cluster:
        • dev plan: 4 vCPU (1 main, 1 worker)
        • prod plan: 8 vCPU (3 main , 1 worker)
      • Each workload cluster:
        • dev plan: 4 vCPU (1 main, 1 worker)
        • prod plan: 12 vCPU (3 main , 3 worker)
      • For example, assuming a single management cluster and all clusters with the same plan:
        Plan Workload Clusters vCPU for Workload vCPU for Management Total vCPU
        Dev 1 4 4 8
        5 20 24
        Prod 1 12 8 20
        5 60 68
    • Sufficient public IP address quotas for your clusters, including the quota for Public IP Addresses - Standard, Public IP Addresses - Basic, and Static Public IP Addresses. A standard Azure account has a quota of 10 public IP addresses per region. Every Tanzu Kubernetes Grid cluster requires 2 Public IP addresses regardless of how many control plane nodes and worker nodes it has. For each Kubernetes Service object with type LoadBalancer, 1 Public IP address is required.
  • Traffic is allowed between your local bootstrap machine and the image repositories listed in the management cluster Bill of Materials (BoM) file, over port 443, for TCP.*
    • The BoM file is under ~/.config/tanzu/tkg/bom/, and its name includes the Tanzu Kubernetes Grid version. For example, tkg-bom-v1.4.3+vmware.1 .yaml.
    • Run a DNS lookup on all imageRepository values to find their CNAMEs.
  • (Optional) OpenSSL installed locally, to create a new keypair or validate the download package thumbprint. See OpenSSL.
  • (Optional) A VNET with:

    • A subnet for the management cluster control plane node
    • A Network Security Group (NSG) in the cluster’s VNet resource group that is on the control plane subnet and has the following inbound security rules, to enable SSH and Kubernetes API server connections:
      • Allow TCP over port 22 for any source and destination
      • Allow TCP over port 6443 for any source and destination Port 6443 is where the Kubernetes API is exposed on VMs in the clusters you create.
    • A subnet for the management cluster worker nodes
    • An NSG for the management cluster worker nodes that is in the cluster’s VNet resource group and on the cluster’s worker node subnet

    If you do not use an existing VNET, the installation process creates a new one.

  • The Azure CLI installed locally. See Install the Azure CLI in the Microsoft Azure documentation.

*Or see Prepare an Internet-Restricted Environment for installing without external network access.

Create Azure NSGs for Existing VNet

Tanzu Kubernetes Grid management and workload clusters on Azure require two Network Security Groups (NSGs) to be defined on their VNet and in their VNet resource group:

  • An NSG named CLUSTER-NAME-controlplane-nsg for the cluster’s control plane nodes.
  • An NSG named CLUSTER-NAME-node-nsg for the cluster’s worker nodes.

    Where CLUSTER-NAME is the name of the cluster.

If you specify an existing VNet for the management cluster, you must create these NSGs as described in the General Requirements above. An existing VNet for a management cluster is specified with Select an existing VNET in the installer interface or AZURE_VNET_NAME in its configuration file.

If you do not specify an existing VNet for the cluster, the deployment process creates a new VNet and the required NSGs.

See the Microsoft Azure table in the Tanzu CLI Configuration File Variable Reference for how to configure the cluster’s VNet, resource groups, and subnets.

Register Tanzu Kubernetes Grid as an Azure Client App

Tanzu Kubernetes Grid manages Azure resources as a registered client application that accesses Azure through a service principal. To create the service principal and configure its access to Azure resources, you can use the az ad sp create-for-rbac command.

  1. Sign in to the Azure CLI by running az login.

  2. Create a service principal and assign the the Owner role to it:

    az ad sp create-for-rbac --role "Owner" --name "APP-NAME" --scopes /subscriptions/SUBSCRIPTION-ID/resourceGroups/RESOURCE-GROUP
    az role assignment create --assignee APP-ID --role "Owner"
    

    Where:

    • APP-NAME is any name to give your service principal
    • SUBSCRIPTION-ID and RESOURCE-GROUP are your Azure subscription ID and VNet resource group
    • APP-ID is the appId value returned from az ad sp create-for-rbac

    For example, to create and assign the Owner role to a service principal named tkg:

    $ az ad sp create-for-rbac --role "Owner" --name "tkg" --scopes /subscriptions/c789uce3-aaaa-bbbb-cccc-a51b6b0gb405/resourceGroups/myrg
    Creating 'Owner' role assignment under scope '/subscriptions/c789uce3-aaaa-bbbb-cccc-a51b6b0gb405'
    The output includes credentials that you must protect. Be sure that you do not include these credentials in your code or check the credentials into your source control. For more information, see https://aka.ms/azadsp-cli
    'name' property in the output is deprecated and will be removed in the future. Use 'appId' instead.
    {
     "appId": "c407cfd4-aaaa-bbbb-cccc-80af703eb0ed",
     "displayName": "tkg",
     "password": "R6yM_.aaaabbbbccccdddd111122223333",
     "tenant": "9c117323-aaaa-bbbb-cccc-9ee430723ba3"
    }
    $ az role assignment create --assignee c407cfd4-aaaa-bbbb-cccc-80af703eb0ed --role "Owner"
    

    Record the output. You will use this information in following Accept the Base Image License steps and later when deploying a management cluster. For the full list of options that are supported by az ad sp create-for-rbac, see az ad sp create-for-rbac in the Azure documentation.

Accept the Base Image License

To run management cluster VMs on Azure, accept the license for their base Kubernetes version and machine OS.

  1. Sign in to the Azure CLI with your tkg service principal.

    az login --service-principal --username AZURE_CLIENT_ID --password AZURE_CLIENT_SECRET --tenant AZURE_TENANT_ID
    

    Where AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, and AZURE_TENANT_ID are your tkg app’s ID and secret and your tenant ID, as recorded in Register Tanzu Kubernetes Grid as an Azure Client App.

  2. Run the az vm image terms accept command, specifying the --plan and your Subscription ID.

    In Tanzu Kubernetes Grid v1.4, the default cluster image --plan value is k8s-1dot21dot8-ubuntu-2004, based on Kubernetes version 1.21.8 and the machine OS, Ubuntu 20.04. Run the following command:

    az vm image terms accept --publisher vmware-inc --offer tkg-capi --plan k8s-1dot21dot8-ubuntu-2004 --subscription AZURE_SUBSCRIPTION_ID
    

    Where AZURE_SUBSCRIPTION_ID is your Azure subscription ID.

You must repeat this to accept the base image license for every version of Kubernetes or OS that you want to use when you deploy clusters, and every time that you upgrade to a new version of Tanzu Kubernetes Grid.

Create an SSH Key Pair (Optional)

You deploy management clusters from a machine referred to as the bootstrap machine, using the Tanzu CLI. To connect to Azure, the bootstrap machine must provide the public key part of an SSH key pair. If your bootstrap machine does not already have an SSH key pair, you can use a tool such as ssh-keygen to generate one.

  1. On your bootstrap machine, run the following ssh-keygen command.

    ssh-keygen -t rsa -b 4096 -C "email@example.com"
    
  2. At the prompt Enter file in which to save the key (/root/.ssh/id_rsa): press Enter to accept the default.
  3. Enter and repeat a password for the key pair.
  4. Add the private key to the SSH agent running on your machine, and enter the password you created in the previous step.

    ssh-add ~/.ssh/id_rsa
    
  5. Open the file .ssh/id_rsa.pub in a text editor so that you can easily copy and paste it when you deploy a management cluster.

Preparation Checklist

Use this checklist to make sure you are prepared to deploy a Tanzu Kubernetes Grid management cluster to Azure:

  • Tanzu CLI installed

    • Run tanzu version. The output should list version: v1.4.3.
  • Azure account

    • Log in to the Azure web portal at https://portal.azure.com.
  • Azure CLI installed

    • Run az version. The output should list the current version of the Azure CLI as listed in Install the Azure CLI, in the Microsoft Azure documentation.
  • Registered tkg app

    • In the Azure portal, select Active Directory > App Registrations > Owned applications and confirm that your tkg app is listed as configured in Register Tanzu Kubernetes Grid as an Azure Client App above, and with a current secret.
    • Alternatively, in the Azure CLI, run az ad sp show --id.
  • Base VM image license accepted

    • Run az vm image terms show --publisher vmware-inc --offer tkg-capi --plan k8s-1dot21dot8-ubuntu-2004. The output should contain "accepted": true.

What to Do Next

For production deployments, it is strongly recommended to enable identity management for your clusters. For information about the preparatory steps to perform before you deploy a management cluster, see Prepare External Identity Management.

If you are using Tanzu Kubernetes Grid in an environment with an external internet connection, once you have set up identity management, you are ready to deploy management clusters to Azure.

check-circle-line exclamation-circle-line close-line
Scroll to top icon