Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Get started with Azure Kubernetes Fleet Manager by using the Azure CLI to create a Fleet Manager and join Azure Kubernetes Service (AKS) clusters as member clusters.
Prerequisites
If you don't have an Azure trail subscription, create a trial subscription before you begin.
Read the conceptual overview of Fleet Manager, which provides an explanation of fleets and member clusters referenced in this document.
Read the conceptual overview of fleet types, which provides a comparison of different fleet configuration options.
An Azure account with an active subscription. Create an account.
An identity (user or service principal) which can be used to log in to Azure CLI. This identity needs to have the following permissions on the Fleet and AKS resource types for completing the steps listed in this quickstart:
- Microsoft.ContainerService/fleets/read
- Microsoft.ContainerService/fleets/write
- Microsoft.ContainerService/fleets/members/read
- Microsoft.ContainerService/fleets/members/write
- Microsoft.ContainerService/fleetMemberships/read
- Microsoft.ContainerService/fleetMemberships/write
- Microsoft.ContainerService/managedClusters/read
- Microsoft.ContainerService/managedClusters/write
Have the Azure CLI version 2.70.0 or later installed. To install or upgrade, see Install the Azure CLI.
You also need the
fleet
Azure CLI extension version 1.5.0 or later, which you can install by running the following command:az extension add --name fleet
Run the following command to update to the latest version of the extension released:
az extension update --name fleet
Set the following environment variables:
export SUBSCRIPTION_ID=<subscription_id> export GROUP=<your_resource_group_name> export FLEET=<your_fleet_name> export LOCATION=<azure-region-name>
Install
kubectl
using theaz aks install-cli
command.az aks install-cli
The AKS clusters you want to join as member clusters need to be running Kubernetes versions supported by AKS. Learn more about AKS version support policy here.
Create a resource group
An Azure resource group is a logical group in which Azure resources are deployed and managed. When you create a resource group, you're prompted to specify a location. This location is the storage location of your resource group metadata and where your resources run in Azure if you don't specify another location during resource creation.
Set the Azure subscription and create a resource group using the az group create
command.
az account set -s ${SUBSCRIPTION_ID}
az group create --name ${GROUP} --location ${LOCATION}
The following output example resembles successful creation of the resource group:
{
"id": "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/fleet-demo",
"location": "<LOCATION>",
"managedBy": null,
"name": "fleet-demo",
"properties": {
"provisioningState": "Succeeded"
},
"tags": null,
"type": "Microsoft.Resources/resourceGroups"
}
Create a Fleet Manager resource
You can create a Fleet Manager at any time, selecting to later add your AKS clusters as member clusters. When created via the Azure CLI, by default, Fleet Manager enables member cluster grouping and update orchestration. If the Fleet Manager is created with a hub cluster, intelligent Kubernetes object placement and load balancing across multiple member clusters is possible. For more information, see the conceptual overview of fleet types, which provides a comparison of different fleet configurations.
Important
You can change from a Fleet Manager without a hub cluster to one with a hub cluster, but not the reverse. For Fleet Managers with a hub cluster, once private or public access is selected it can't be changed.
If you want to use Fleet Manager only for Kubernetes or node image update orchestration, you can create a Fleet resource without the hub cluster using the az fleet create
command.
az fleet create \
--resource-group ${GROUP} \
--name ${FLEET} \
--location ${LOCATION} \
--enable-managed-identity
Your output should look similar to the following example output:
{
"etag": "...",
"hubProfile": null,
"id": "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/fleet-demo/providers/Microsoft.ContainerService/fleets/fleet-demo",
"identity": {
"principalId": <system-identity-id>,
"tenantId": <entra-tenant-id>,
"type": "SystemAssigned",
"userAssignedIdentities": null
},
"location": "<LOCATION>",
"name": "fleet-demo",
"provisioningState": "Succeeded",
"resourceGroup": "fleet-demo",
"systemData": {
"createdAt": "2023-11-03T17:15:19.610149+00:00",
"createdBy": "<user>",
"createdByType": "User",
"lastModifiedAt": "2023-11-03T17:15:19.610149+00:00",
"lastModifiedBy": "<user>",
"lastModifiedByType": "User"
},
"tags": null,
"type": "Microsoft.ContainerService/fleets"
}
Join member clusters
Fleet currently supports joining existing AKS clusters as member clusters.
Set the following environment variables for member clusters:
export MEMBER_NAME_1=aks-member-1 export MEMBER_CLUSTER_ID_1=/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${GROUP}/providers/Microsoft.ContainerService/managedClusters/${MEMBER_NAME_1}
Join your existing AKS clusters to the Fleet resource using the
az fleet member create
command.az fleet member create \ --resource-group ${GROUP} \ --fleet-name ${FLEET} \ --name ${MEMBER_NAME_1} \ --member-cluster-id ${MEMBER_CLUSTER_ID_1}
Your output should look similar to the following example output:
{ "clusterResourceId": "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<GROUP>/providers/Microsoft.ContainerService/managedClusters/aks-member-x", "etag": "...", "id": "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<GROUP>/providers/Microsoft.ContainerService/fleets/<FLEET>/members/aks-member-x", "name": "aks-member-1", "provisioningState": "Succeeded", "resourceGroup": "<GROUP>", "systemData": { "createdAt": "2022-10-04T19:04:56.455813+00:00", "createdBy": "<user>", "createdByType": "User", "lastModifiedAt": "2022-10-04T19:04:56.455813+00:00", "lastModifiedBy": "<user>", "lastModifiedByType": "User" }, "type": "Microsoft.ContainerService/fleets/members" }
Verify that the member clusters successfully joined the Fleet resource using the
az fleet member list
command.az fleet member list \ --resource-group ${GROUP} \ --fleet-name ${FLEET} \ -o table
If successful, your output should look similar to the following example output:
ClusterResourceId Name ProvisioningState ResourceGroup ----------------------------------------------------------------------------------------------------------------------------------------------- ------------ ------------------- --------------- /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<GROUP>/providers/Microsoft.ContainerService/managedClusters/aks-member-1 aks-member-1 Succeeded <GROUP> /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<GROUP>/providers/Microsoft.ContainerService/managedClusters/aks-member-2 aks-member-2 Succeeded <GROUP> /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<GROUP>/providers/Microsoft.ContainerService/managedClusters/aks-member-3 aks-member-3 Succeeded <GROUP>