Skip to content

Commit e5e0bc4

Browse files
Merge pull request #269372 from schaffererin/aks-fleet-quickstarts
Simplify Fleet Azure CLI quickstart and add portal quickstart
2 parents efeb907 + 86568f1 commit e5e0bc4

9 files changed

+251
-286
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
title: "Access the Kubernetes API of the Fleet resource"
3+
description: Learn how to access the Kubernetes API of the Fleet resource.
4+
ms.topic: how-to
5+
ms.date: 03/20/2024
6+
author: shashankbarsin
7+
ms.author: shasb
8+
ms.service: kubernetes-fleet
9+
---
10+
11+
# Access the Kubernetes API of the Fleet resource with Azure Kubernetes Fleet Manager
12+
13+
If your Azure Kubernetes Fleet Manager resource was created with the hub cluster enabled, then it can be used to centrally control scenarios like Kubernetes resource propagation. In this article, you learn how to access the Kubernetes API of the hub cluster managed by the Fleet resource.
14+
15+
## Prerequisites
16+
17+
[!INCLUDE [free trial note](../../includes/quickstarts-free-trial-note.md)]
18+
19+
* You must have a Fleet resource with a hub cluster and member clusters. If you don't have this resource, follow [Quickstart: Create a Fleet resource and join member clusters](quickstart-create-fleet-and-members.md).
20+
* The identity (user or service principal) you're using needs to have the Microsoft.ContainerService/fleets/listCredentials/action on the Fleet resource.
21+
22+
## Access the Kubernetes API of the Fleet resource cluster
23+
24+
1. Set the following environment variables for your subscription ID, resource group, and Fleet resource, and set the default Azure subscription to use using the [`az account set`][az-account-set] command.
25+
26+
```azurecli-interactive
27+
export SUBSCRIPTION_ID=<subscription-id>
28+
az account set --subscription ${SUBSCRIPTION_ID}
29+
30+
export GROUP=<resource-group-name>
31+
export FLEET=<fleet-name>
32+
```
33+
34+
2. Get the kubeconfig file of the hub cluster Fleet resource using the [`az fleet get-credentials`][az-fleet-get-credentials] command.
35+
36+
```azurecli-interactive
37+
az fleet get-credentials --resource-group ${GROUP} --name ${FLEET}
38+
```
39+
40+
Your output should look similar to the following example output:
41+
42+
```output
43+
Merged "hub" as current context in /home/fleet/.kube/config
44+
```
45+
46+
3. Set the following environment variable for the `id` of the hub cluster Fleet resource:
47+
48+
```azurecli-interactive
49+
export FLEET_ID=/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${GROUP}/providers/Microsoft.ContainerService/fleets/${FLEET}
50+
```
51+
52+
4. Authorize your identity to the hub cluster Fleet resource's Kubernetes API server using the following commands:
53+
54+
For the `ROLE` environment variable, you can use one of the following four built-in role definitions as the value:
55+
56+
* Azure Kubernetes Fleet Manager RBAC Reader
57+
* Azure Kubernetes Fleet Manager RBAC Writer
58+
* Azure Kubernetes Fleet Manager RBAC Admin
59+
* Azure Kubernetes Fleet Manager RBAC Cluster Admin
60+
61+
```azurecli-interactive
62+
export IDENTITY=$(az ad signed-in-user show --query "id" --output tsv)
63+
export ROLE="Azure Kubernetes Fleet Manager RBAC Cluster Admin"
64+
az role assignment create --role "${ROLE}" --assignee ${IDENTITY} --scope ${FLEET_ID}
65+
```
66+
67+
Your output should be similar to the following example output:
68+
69+
```output
70+
{
71+
"canDelegate": null,
72+
"condition": null,
73+
"conditionVersion": null,
74+
"description": null,
75+
"id": "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<GROUP>/providers/Microsoft.ContainerService/fleets/<FLEET>/providers/Microsoft.Authorization/roleAssignments/<assignment>",
76+
"name": "<name>",
77+
"principalId": "<id>",
78+
"principalType": "User",
79+
"resourceGroup": "<GROUP>",
80+
"roleDefinitionId": "/subscriptions/<SUBSCRIPTION_ID>/providers/Microsoft.Authorization/roleDefinitions/18ab4d3d-a1bf-4477-8ad9-8359bc988f69",
81+
"scope": "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<GROUP>/providers/Microsoft.ContainerService/fleets/<FLEET>",
82+
"type": "Microsoft.Authorization/roleAssignments"
83+
}
84+
```
85+
86+
5. Verify you can access the API server using the `kubectl get memberclusters` command.
87+
88+
```bash
89+
kubectl get memberclusters
90+
```
91+
92+
If successful, your output should look similar to the following example output:
93+
94+
```output
95+
NAME JOINED AGE
96+
aks-member-1 True 2m
97+
aks-member-2 True 2m
98+
aks-member-3 True 2m
99+
```
100+
101+
## Next steps
102+
103+
* Review the [API specifications][fleet-apispec] for all Fleet custom resources.
104+
* Review our [troubleshooting guide][troubleshooting-guide] to help resolve common issues related to the Fleet APIs.
105+
106+
<!-- LINKS --->
107+
[fleet-apispec]: https://github.com/Azure/fleet/blob/main/docs/api-references.md
108+
[troubleshooting-guide]: https://github.com/Azure/fleet/blob/main/docs/troubleshooting/README.md
109+
[az-fleet-get-credentials]: /cli/azure/fleet#az-fleet-get-credentials
110+
[az-account-set]: /cli/azure/account#az-account-set

articles/kubernetes-fleet/index.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ landingContent:
3737
url: /cli/azure/fleet
3838
- text: REST
3939
url: /rest/api/fleet
40+
- text: Terraform
41+
url: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/kubernetes_fleet_manager
4042
- text: PowerShell
4143
url: /powershell/module/az.fleet
4244
- text: .NET

articles/kubernetes-fleet/l4-load-balancing.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
title: "How to set up multi-cluster Layer 4 load balancing across Azure Kubernetes Fleet Manager member clusters (preview)"
33
description: Learn how to use Azure Kubernetes Fleet Manager to set up multi-cluster Layer 4 load balancing across workloads deployed on multiple member clusters.
44
ms.topic: how-to
5-
ms.date: 09/09/2022
5+
ms.date: 03/20/2024
66
author: shashankbarsin
77
ms.author: shasb
88
ms.service: kubernetes-fleet
99
ms.custom:
1010
- devx-track-azurecli
11-
- ignite-2023
1211
---
1312

1413
# Set up multi-cluster layer 4 load balancing across Azure Kubernetes Fleet Manager member clusters (preview)
@@ -25,13 +24,14 @@ You can follow this document to set up layer 4 load balancing for such multi-clu
2524

2625
* Read the [conceptual overview of this feature](./concepts-l4-load-balancing.md), which provides an explanation of `ServiceExport` and `MultiClusterService` objects referenced in this document.
2726

28-
* You must have a fleet resource with member clusters with deployed workload. If you don't have this resource, follow [Quickstart: Create a Fleet resource and join member clusters](quickstart-create-fleet-and-members.md) and [Propagate Kubernetes configurations from a Fleet resource to member clusters](resource-propagation.md).
29-
30-
* These target clusters should be using [Azure CNI (Container Networking Interface) networking](../aks/configure-azure-cni.md).
27+
* You must have a Fleet resource with a hub cluster and member clusters. If you don't have this resource, follow [Quickstart: Create a Fleet resource and join member clusters](quickstart-create-fleet-and-members.md).
3128

3229
* The target Azure Kubernetes Service (AKS) clusters on which the workloads are deployed need to be present on either the same [virtual network](../virtual-network/virtual-networks-overview.md) or on [peered virtual networks](../virtual-network/virtual-network-peering-overview.md).
3330

34-
* These target clusters have to be [added as member clusters to the Fleet resource](./quickstart-create-fleet-and-members.md#join-member-clusters).
31+
* These target clusters have to be [added as member clusters to the Fleet resource](./quickstart-create-fleet-and-members.md#join-member-clusters).
32+
* These target clusters should be using [Azure CNI (Container Networking Interface) networking](../aks/configure-azure-cni.md).
33+
34+
* You must gain access to the Kubernetes API of the hub cluster by following the steps in [Access the Kubernetes API of the Fleet resource](./access-fleet-kubernetes-api.md).
3535

3636
* Set the following environment variables and obtain the kubeconfigs for the fleet and all member clusters:
3737

@@ -47,7 +47,7 @@ You can follow this document to set up layer 4 load balancing for such multi-clu
4747

4848
[!INCLUDE [preview features note](~/articles/reusable-content/azure-cli/azure-cli-prepare-your-environment-no-header.md)]
4949

50-
## Deploy a sample workload to demo clusters
50+
## Deploy a workload across member clusters of the Fleet resource
5151

5252
> [!NOTE]
5353
>
57.4 KB
Loading
40.6 KB
Loading
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: "Quickstart: Create an Azure Kubernetes Fleet Manager resource and join member clusters using Azure portal"
3+
description: In this quickstart, you learn how to create an Azure Kubernetes Fleet Manager resource and join member clusters using Azure portal.
4+
ms.date: 03/20/2024
5+
author: shashankbarsin
6+
ms.author: shasb
7+
ms.service: kubernetes-fleet
8+
ms.custom: template-quickstart, mode-other
9+
ms.devlang: azurecli
10+
ms.topic: quickstart
11+
---
12+
13+
# Quickstart: Create an Azure Kubernetes Fleet Manager resource and join member clusters using Azure portal
14+
15+
Get started with Azure Kubernetes Fleet Manager (Fleet) by using the Azure portal to create a Fleet resource and later connect Azure Kubernetes Service (AKS) clusters as member clusters.
16+
17+
## Prerequisites
18+
19+
* Read the [conceptual overview of this feature](./concepts-fleet.md), which provides an explanation of fleets and member clusters referenced in this document.
20+
* An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
21+
* An identity (user or service principal) with the following permissions on the Fleet and AKS resource types for completing the steps listed in this quickstart:
22+
23+
* Microsoft.ContainerService/fleets/read
24+
* Microsoft.ContainerService/fleets/write
25+
* Microsoft.ContainerService/fleets/members/read
26+
* Microsoft.ContainerService/fleets/members/write
27+
* Microsoft.ContainerService/fleetMemberships/read
28+
* Microsoft.ContainerService/fleetMemberships/write
29+
* Microsoft.ContainerService/managedClusters/read
30+
* Microsoft.ContainerService/managedClusters/write
31+
* Microsoft.ContainerService/managedClusters/listClusterUserCredential/action
32+
33+
* The AKS clusters that you want to join as member clusters to the Fleet resource need to be within the supported versions of AKS. Learn more about AKS version support policy [here](../aks/supported-kubernetes-versions.md#kubernetes-version-support-policy).
34+
35+
## Create a Fleet resource
36+
37+
1. Sign in to the [Azure portal](https://portal.azure.com/).
38+
2. On the Azure portal home page, select **Create a resource**.
39+
3. In the search box, enter **Kubernetes Fleet Manager** and select **Create > Kubernetes Fleet Manager** from the search results.
40+
4. On the **Basics** tab, configure the following options:
41+
42+
* Under **Project details**:
43+
* **Subscription**: Select the Azure subscription that you want to use.
44+
* **Resource group**: Select an existing resource group or select **Create new** to create a new resource group.
45+
* Under **Fleet details**:
46+
* **Name**: Enter a unique name for the Fleet resource.
47+
* **Region**: Select the region where you want to create the Fleet resource.
48+
* **Hub cluster mode**: Select **Without hub cluster** if you want to use Fleet only for update orchestration. Select **With hub cluster (preview)** if you want to use Fleet for Kubernetes object propagation and multi-cluster load balancing in addition to update orchestration.
49+
50+
![Create Fleet resource](./media/quickstart-create-fleet-and-members-portal-basics.png)
51+
52+
5. Select **Next: Member clusters**.
53+
6. On the **Member clusters** tab, select **Add** to add an existing AKS cluster as a member cluster to the Fleet resource. You can add multiple member clusters to the Fleet resource.
54+
55+
![Add member clusters](./media/quickstart-create-fleet-and-members-portal-members.png)
56+
57+
7. Select **Review + create** > **Create** to create the Fleet resource.
58+
59+
It takes a few minutes to create the Fleet resource. When your deployment is complete, you can navigate to your resource by selecting **Go to resource**.
60+
61+
## Next steps
62+
63+
* [Orchestrate updates across multiple member clusters](./update-orchestration.md).
64+
* [Set up Kubernetes resource propagation from hub cluster to member clusters](./resource-propagation.md).
65+
* [Set up multi-cluster layer-4 load balancing](./l4-load-balancing.md).

0 commit comments

Comments
 (0)