How can I give my own name to the kubernetes-internal load balancer in an Azure…
- User
How can I give my own name to the kubernetes-internal load balancer in an Azure Kubernetes Service (AKS) while I create the cluster?
Assistant
How can I give my own name to the kubernetes-internal load balancer in an Azure Kubernetes Service (AKS) while I create the cluster?
To give a custom name to the Kubernetes internal load balancer in an Azure Kubernetes Service (AKS) while creating the cluster, you can follow these steps:
Create a service principal: Before creating the AKS cluster, you need to create a service principal for the cluster to interact with Azure resources. You can use the following Azure CLI command to create a service principal:
az ad sp create-for-rbac --name <service-principal-name> --role contributor --scopes /subscriptions/<subscription-id>
Replace <service-principal-name> with your desired name and <subscription-id> with your Azure subscription ID. This command will output the service principal's app ID and password, which you'll need in the next step.
Create the AKS cluster with a custom load balancer name: Use the following Azure CLI command to create the AKS cluster with a custom load balancer name:
az aks create \
--resource-group <resource-group-name> \
--name <aks-cluster-name> \
--service-principal <service-principal-app-id> \
--client-secret <service-principal-password> \
--load-balancer-sku standard \
--load-balancer-name <custom-load-balancer-name> \
--location <location> \
--kubernetes-version <kubernetes-version> \
--network-plugin azure \
--vnet-subnet-id <subnet-id>
Replace the placeholders with your desired values:
<resource-group-name>: The name of the resource group where the AKS cluster will be created.<aks-cluster-name>: The name of the AKS cluster.<service-principal-app-id>: The app ID of the service principal you created in step 1.<service-principal-password>: The password of the service principal you created in step 1.<custom-load-balancer-name>: The custom name you want to give to the internal load balancer.<location>: The Azure region where the AKS cluster will be created.<kubernetes-version>: The Kubernetes version for the AKS cluster.<subnet-id>: The ID of the subnet where the AKS cluster will be deployed. You can get this value using the az network vnet subnet show command.The --load-balancer-sku standard parameter ensures that the load balancer is a standard SKU, which supports custom names. The --load-balancer-name parameter sets the custom name for the internal load balancer.
After creating the AKS cluster, you can verify the custom load balancer name using the following command:
az aks show --resource-group <resource-group-name> --name <aks-cluster-name> --query loadBalancerProfile.managedOutboundIPs.name -o tsv
This command will display the name of the internal load balancer.
Not yet included in a published release.