Deploying Antrea on AKS

This document describes steps to deploy Antrea in NetworkPolicy only mode to an Azure AKS cluster.

AKS Prerequisites

Install the Azure Cloud CLI. Refer to Azure CLI installation guide

Creating the cluster

You can use any method to create an AKS cluster. The example given here is using the Azure Cloud CLI.

  1. Create an AKS Cluster

    1. export RESOURCE_GROUP_NAME=aks-antrea-cluster
    2. export CLUSTER_NAME=aks-antrea-cluster
    3. export LOCATION=westus
    4. az group create --name $RESOURCE_GROUP_NAME --location $LOCATION
    5. az aks create \
    6. --resource-group $RESOURCE_GROUP_NAME \
    7. --name $CLUSTER_NAME \
    8. --node-count 2 \
    9. --network-plugin azure

    Note Do not specify network-policy option.

  2. Get AKS Cluster Credentials

    1. az aks get-credentials --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP_NAME
  3. Access your Cluster

    1. kubectl get nodes
    2. NAME STATUS ROLES AGE VERSION
    3. aks-nodepool1-84330359-vmss000000 Ready agent 6m21s v1.16.10
    4. aks-nodepool1-84330359-vmss000001 Ready agent 6m25s v1.16.10

Deploying Antrea

  1. Prepare the Cluster Nodes

    Deploy antrea-node-init DaemonSet to enable azure cni to operate in transparent mode.

    1. kubectl apply -f https://raw.githubusercontent.com/vmware-tanzu/antrea/main/build/yamls/antrea-aks-node-init.yml
  2. Deploy Antrea

    To deploy a released version of Antrea, pick a deployment manifest from the list of releases. Note that AKS support was added in release 0.9.0, which means you cannot pick a release older than 0.9.0. For any given release <TAG> (e.g. v0.9.0), you can deploy Antrea as follows:

    1. kubectl apply -f https://github.com/vmware-tanzu/antrea/releases/download/<TAG>/antrea-aks.yml

    To deploy the latest version of Antrea (built from the main branch), use the checked-in deployment yaml:

    1. kubectl apply -f https://raw.githubusercontent.com/vmware-tanzu/antrea/main/build/yamls/antrea-aks.yml

    The command will deploy a single replica of Antrea controller to the AKS cluster and deploy Antrea agent to every Node. After a successful deployment you should be able to see these Pods running in your cluster:

    1. $ kubectl get pods --namespace kube-system -l app=antrea
    2. NAME READY STATUS RESTARTS AGE
    3. antrea-agent-bpj72 2/2 Running 0 40s
    4. antrea-agent-j2sjz 2/2 Running 0 40s
    5. antrea-controller-6f7468cbff-5sk4t 1/1 Running 0 43s
    6. antrea-node-init-6twqg 1/1 Running 0 2m
    7. antrea-node-init-mqsqr 1/1 Running 0 2m
  3. Restart remaining Pods

    Once Antrea is up and running, restart all Pods in all Namespaces (kube-system, etc) so they can be managed by Antrea.

    1. kubectl delete pods -n kube-system $(kubectl get pods -n kube-system -o custom-columns=NAME:.metadata.name,HOSTNETWORK:.spec.hostNetwork --no-headers=true | grep '<none>' | awk '{ print $1 }')
    2. pod "coredns-544d979687-96xm9" deleted
    3. pod "coredns-544d979687-p7dfb" deleted
    4. pod "coredns-autoscaler-78959b4578-849k8" deleted
    5. pod "dashboard-metrics-scraper-5f44bbb8b5-5qkkx" deleted
    6. pod "kube-proxy-6qxdw" deleted
    7. pod "kube-proxy-h6d89" deleted
    8. pod "kubernetes-dashboard-785654f667-7twsm" deleted
    9. pod "metrics-server-85c57978c6-pwzcx" deleted
    10. pod "tunnelfront-649ff5fb55-5lxg7" deleted