- Azure CLI
- Helm 3
- A Kubernetes cluster on Azure with a dedicated nodepool backed by Azure Virtual Machine Scale Set (VMSS) with at least one node (VMSS instance).
- The nodes should be tainted with
kubeegressgateway.azure.com/mode=true:NoSchedule
so that no other workload can land on. - The nodes should be labeled with
kubeegressgateway.azure.com/mode: true
so that kube-egress-gateway DaemonSets NodeSelector can identify these. - The nodes should be linux only.
- The nodes should be excluded from cluster autoscaler.
- The nodes should be tainted with
kube-egress-gateway components communicates with Azure Resource Manager (ARM) to manipulate Azure resources. It needs an identity to access the APIs. kube-egress-gateway supports both Managed Identity and Service Principal.
- Create a UserAssigned managed identity. This identity can be created in any resource group as long as permissions are set correctly.
identityName="<identity name>" resourceGroup="<resource group>" az identity create -g $resourceGroup -n $identityName
- Retrieve the
identityID
andclientID
from the identity you just created.identityClientId=$(az identity show -g $resourceGroup -n $identityName -o tsv --query "clientId") identityId=$(az identity show -g $resourceGroup -n $identityName -o tsv --query "id")
- Assign "Network Contributor" and "Virtual Machine Contributor" roles to the identity. kube-egress-gateway components need these two roles to configure Load Balancer, Public IP Prefix, and VMSS resources.
networkResourceGroup="<network resource group>" vmssResourceGroup="<vmss resource group>" networkRGID="/subscriptions/<your subscriptionID>/resourceGroups/$networkResourceGroup" vmssRGID="/subscriptions/<your subscriptionID>/resourceGroups/$vmssResourceGroup" vmssID="/subscriptions/<your subscriptionID>/resourceGroups/$vmssResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/<your gateway vmss>" # assign Network Contributor role on scope networkResourceGroup and vmssResourceGroup to the identity az role assignment create --role "Network Contributor" --assignee $identityClientId --scope $networkRGID az role assignment create --role "Network Contributor" --assignee $identityClientId --scope $vmssRGID # assign Virtual Machine Contributor role on scope gateway vmss to the identity az role assignment create --role "Virtual Machine Contributor" --assignee $identityClientId --scope $vmssID
- Fill the identity clientID in your Azure cloud config file. See sample_cloud_config_msi.yaml for example.
useManagedIdentityExtension: true userAssignedIdentityID: "$identityClientId"
- Create a service principal and assign Contributor role on network resource group and vmss resource group scopes. And you get sp clientID and secret from the output.
appName="<app name>" networkRGID="/subscriptions/<your subscriptionID>/resourceGroups/$networkResourceGroup" vmssRGID="/subscriptions/<your subscriptionID>/resourceGroups/$vmssResourceGroup" az ad sp create-for-rbac -n $appName --role Contributor --scopes $networkRGID $vmssRGID
- Fill the sp clientID and secret in your Azure cloud config file. See sample_cloud_config_sp.yaml for example.
useManagedIdentityExtension: false aadClientId: "<sp clientID>" aadClientSecret: "<sp secret>"
See details here.