Skip to content

Commit 7ff56d9

Browse files
Merge pull request #3266 from MicrosoftDocs/main638590787238304600sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 39a72e3 + de27eb8 commit 7ff56d9

File tree

1 file changed

+55
-9
lines changed

1 file changed

+55
-9
lines changed

AKS-Hybrid/deploy-load-balancer-cli.md

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ ms.lastreviewed: 04/02/2024
1414

1515
[!INCLUDE [hci-applies-to-23h2](includes/hci-applies-to-23h2.md)]
1616

17-
The main purpose of a load balancer is to distribute traffic across multiple nodes in a Kubernetes cluster. This can help prevent downtime and improve overall performance of applications. AKS enabled by Azure Arc supports creating [MetalLB](https://metallb.universe.tf/) load balancer instance on your Kubernetes cluster using the `Arc Networking` k8s-extension.
17+
The main purpose of a load balancer is to distribute traffic across multiple nodes in a Kubernetes cluster. This can help prevent downtime and improve overall performance of applications. AKS enabled by Azure Arc supports creating [MetalLB](https://metallb.universe.tf/) load balancer instance on your Kubernetes cluster using the `Arc Kubernetes Runtime` k8s-extension.
1818

1919
## Prerequisites
2020

21-
- A Kubernetes cluster with at least one Linux node. You can create a Kubernetes cluster on Azure Stack HCI 23H2 using the [Azure CLI](aks-create-clusters-cli.md) or the [Azure portal](aks-create-clusters-portal.md).
22-
- Make sure you have enough IP addresses for the load balancer. Ensure that the IP addresses reserved for the load balancer do not conflict with the IP addresses in Arc VM logical networks and control plane IPs. For more information about IP address planning and networking in Kubernetes, see [Networking requirements for AKS on Azure Stack HCI 23H2](aks-hci-network-system-requirements.md).
21+
- An Azure Arc enabled Kubernetes cluster with at least one Linux node. You can create a Kubernetes cluster on Azure Stack HCI 23H2 using the [Azure CLI](aks-create-clusters-cli.md) or the [Azure portal](aks-create-clusters-portal.md). AKS on Azure Stack HCI 23H2 clusters are Arc enabled by default.
22+
- Make sure you have enough IP addresses for the load balancer. For AKS on Azure Stack HCI 23H2, ensure that the IP addresses reserved for the load balancer do not conflict with the IP addresses in Arc VM logical networks and control plane IPs. For more information about IP address planning and networking in Kubernetes, see [Networking requirements for AKS on Azure Stack HCI 23H2](aks-hci-network-system-requirements.md).
2323
- This how-to guide assumes you understand how Metal LB works. For more information, see the [overview for MetalLB in Arc Kubernetes clusters](load-balancer-overview.md).
2424

2525
## Install the Azure CLI extension
@@ -30,25 +30,71 @@ Run the following command to install the necessary Azure CLI extension:
3030
az extension add -n k8s-runtime --upgrade
3131
```
3232

33-
## Enable load balancer Arc extension
33+
## Enable MetalLB Arc extension
3434

3535
Configure the following variables before proceeding:
3636

3737
| Parameter | Description |
3838
| ----------------------------- | ------------------------ |
3939
| `$subId` | Azure subscription ID of your Kubernetes cluster. |
40-
| `$rgName` | Azure resource group for your Kubernetes cluster. |
41-
| `$clusterName` | The name of your AKS Arc cluster. |
40+
| `$rgName` | Azure resource group of your Kubernetes cluster. |
41+
| `$clusterName` | The name of your Kubernetes cluster. |
4242

43-
Use the [`az k8s-runtime load-balancer enable`](/cli/azure/k8s-runtime/load-balancer#az-k8s-runtime-load-balancer-enable) command to install the Arc extension and register the resource provider for your Kubernetes cluster. The `--resource-uri` parameter refers to the resource manager ID of your AKS Arc cluster.
43+
### Option 1: Enable MetalLB Arc extension using `az k8s-runtime load-balancer enable` command
44+
45+
To enable the MetalLB Arc extension using the following command, you must have [Graph permission Application.Read.All](/graph/permissions-reference#applicationreadall). You can check if you have this permission by logging into your Azure subscription, and running the following command:
46+
47+
```azurecli
48+
`az ad sp list --filter "appId eq '087fca6e-4606-4d41-b3f6-5ebdf75b8b4c'" --output json`
49+
```
50+
If the command fails, contact your Azure tenant administrator to get `Application.Read.All` role.
51+
52+
If you do have the permission, you can use the [`az k8s-runtime load-balancer enable`](/cli/azure/k8s-runtime/load-balancer#az-k8s-runtime-load-balancer-enable) command to install the Arc extension and register the resource provider for your Kubernetes cluster. The `--resource-uri` parameter refers to the resource manager ID of your Kubernetes cluster.
4453

4554
```azurecli
4655
az k8s-runtime load-balancer enable --resource-uri subscriptions/$subId/resourceGroups/$rgName/providers/Microsoft.Kubernetes/connectedClusters/$clusterName
4756
```
4857

58+
### Option 2: Enable MetalLB Arc Kubernetes extension using `az k8s-extension add` command
59+
60+
If you don't have [Graph permission Application.Read.All](/graph/permissions-reference#applicationreadall), you can follow these steps:
61+
62+
1. Register the `Microsoft.KubernetesRuntime RP` if you haven't already done so. Note that you only need to register once per Azure subscription. You can also register resource providers using the Azure portal. For more information about how to register resource providers and required permissions, see [how to register a resource provider](/azure/azure-resource-manager/management/resource-providers-and-types#register-resource-provider).
63+
64+
```azurecli
65+
az provider register -n Microsoft.KubernetesRuntime
66+
```
67+
68+
You can check if the resource provider has been registered successfully by running the following command.
69+
70+
```azurecli
71+
az provider show -n Microsoft.KubernetesRuntime -o table
72+
```
73+
74+
Expected output:
75+
```output
76+
Namespace RegistrationPolicy RegistrationState
77+
--------------------------- -------------------- -------------------
78+
Microsoft.KubernetesRuntime RegistrationRequired Registered
79+
```
80+
81+
2. To install the MetalLB Arc extension, obtain the AppID of the MetalLB extension resource provider, and then run the extension create command. You must run the following commands once per Arc Kubernetes cluster.
82+
83+
Obtain the Application ID of the Arc extension by running [az ad sp list](/cli/azure/ad/sp?view=azure-cli-latest#az-ad-sp-list). In order to run the following command, you must be a `user` member of your Azure tenant. For more information about user and guest membership, see [default user permissions in Microsoft Entra ID](/entra/fundamentals/users-default-permissions).
84+
85+
```azurecli
86+
$objID = az ad sp list --filter "appId eq '087fca6e-4606-4d41-b3f6-5ebdf75b8b4c'" --query "[].id" --output tsv
87+
```
88+
89+
Once you have the $objID, you can install the MetalLB Arc extension on your Kubernetes cluster. To run the below command, you need to have [**Kubernetes extension contributor**](/azure/role-based-access-control/built-in-roles/containers#kubernetes-extension-contributor) role.
90+
91+
```azurecli
92+
az k8s-extension create --cluster-name $clusterName -g $rgName --cluster-type connectedClusters --extension-type microsoft.arcnetworking --config k8sRuntimeFpaObjectId=$objID -n arcnetworking
93+
```
94+
4995
## Deploy MetalLB load balancer on your Kubernetes cluster
5096

51-
You can now create a load balancer for your Kubernetes cluster remotely by running the [`az k8s-runtime load-balancer create`](/cli/azure/k8s-runtime/load-balancer#az-k8s-runtime-load-balancer-create) command. This command creates a custom resource of kind `IPAddressPool` in namespace `kube-system`.
97+
You can now create a load balancer for your Kubernetes cluster remotely by running the [`az k8s-runtime load-balancer create`](/cli/azure/k8s-runtime/load-balancer#az-k8s-runtime-load-balancer-create) command. This command creates a custom resource of type `IPAddressPool` in the namespace `kube-system`.
5298

5399
Configure the following variables before proceeding:
54100

@@ -83,4 +129,4 @@ az k8s-runtime bgp-peer create --bgp-peer-name $peerName --resource-uri subscrip
83129

84130
## Next steps
85131

86-
-[Use GitOps Flux v2 Arc extension to deploy applications on your Kubernetes cluster](/azure/azure-arc/kubernetes/monitor-gitops-flux-2)
132+
- [Use GitOps Flux v2 Arc extension to deploy applications on your Kubernetes cluster](/azure/azure-arc/kubernetes/monitor-gitops-flux-2)

0 commit comments

Comments
 (0)