Skip to content

How to Create an AKS Cluster with Kubenet

Last validated:
View as Markdown

WHAT TO EXPECT

In this section, users will learn how to deploy an AKS Cluster with Kubenet as the default network plugin.

Creating an AKS Cluster

cloudSwXtch VM Minimum Requirements

Before you start, ensure that your cloudSwXtch has met the following minimum requirements:

  • Must have at least 4, preferably 8 cores.
  • Must have at least 2 NICs. Both NICs must share a single subnet. The 2nd one must support accelerated networking.
  • Must run one of the operating systems listed in cloudSwXtch System Requirements.

A cloudSwXtch must be created before you install the xNIC on the AKS Cluster. For more information on Azure cloudSwXtch installation, see: cloudSwXtch on Azure

Users will need two items in order to create the AKS Cluster with Kubenet: AZ CLI and kubectl.

AZ CLI comes installed on Azure Cloudshell, while kubectl can be either installed on your active Cloudshell session, or on any VM that you want to use for managing the K8s cluster.

Prior to running the script, ensure the following are already created in Azure:

  • Azure Resource Group (must be the same as the one used to create the cloudSwXtch)
  • Azure VNET (must be the same as the one used to create the cloudSwXtch)
  • Azure Control Subnet (must be the same as the one used to create the cloudSwXtch)

Each of the components must match the one used to create the cloudSwXtch on Azure.

The cluster nodes must be able to reach the cloudSwXtch control IP on TCP 9443 (control) and TCP 443 (the cloudSwXtch's xNIC image registry).

AKS with Kubenet CNI Creation

  1. Log into the Azure Portal.

  2. Open cloudshell as bash.

k8s-AKS-cloudshell-bash

  1. Run the following command to download the kubectl binary:
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
  1. Install AZ CLI by following instructions in the  link: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli

  2. Run the following script replacing the following:

  3. : User-assigned name for AKS Cluster

  4. : Azure Resource Group
  5. : Azure VNET
  6. : Azure CONTROL Subnet

This is to install a simple 2-node AKS with Kubenet CNI.

export NAME="<cluster_name>"
export AZURE_RESOURCE_GROUP="<cloudswxtch_RG>"

# Get the Subnet id
export SUBNET_ID="$(az network vnet subnet show -g ${AZURE_RESOURCE_GROUP} -n <cloudswxtch_subnet> --vnet-name <cloudswxtch_vnet> --query id --output tsv)"

# Create AKS cluster
az aks create \
  --generate-ssh-keys \
  --resource-group "${AZURE_RESOURCE_GROUP}" \
  --name "${NAME}" \
  --vnet-subnet-id "${SUBNET_ID}" \
  --node-vm-size Standard_Ds2_v2 \
  --node-count 2

# Get the credentials to access the cluster with kubectl
az aks get-credentials --resource-group "${AZURE_RESOURCE_GROUP}" --name "${NAME}"

After executing the script with the replaced values, the AKS Cluster will be created. Users will get the following line as confirmation.

Merged "sample-kubenet" as current context in <your_home_directory>/.kube/config

Note: The user in this example used the name "sample-kubenet" for their . You may choose whatever you want to name your AKS Cluster

  1. Confirm the cluster is available and reachable by running the following command:
$ kubectl config get-contexts

Example Response

$ kubectl config get-contexts
CURRENT   NAME                  CLUSTER               AUTHINFO                                              NAMESPACE
*         sample-kubenet        sample-kubenet        clusterUser_swxtch-bosch_sample-kubenet
$

Installing xNIC in Kubernetes Cluster

After creating an AKS Cluster with Kubenet CNI, continue on to Installing xNIC on Kubernetes Cluster for instructions on how to deploy an xNIC.