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.
Applies to: ✔️ Fleet Manager with hub cluster
Platform administrators can control how Azure Kubernetes Fleet Manager rolls out resource placement updates to Fleet-managed clusters by defining staged update strategies made up of stages and groups. Within each stage and group, they can configure approvals and timed pauses to enforce governance and reduce rollout risk. Because the strategy is defined as a reusable resource, you can manage it independently from individual update runs and apply it consistently across different placements.
This article explains how to create and manage Azure Kubernetes Fleet Manager resource placement staged update strategies by using groups and stages.
You can complete the steps in this article using either the Azure portal or the Azure CLI.
Note
You can use Fleet Manager's resource placement with AKS and Azure Arc-enabled Kubernetes clusters.
Before you begin
- If you don't have an Azure account, create a free account before you begin.
- Read the conceptual overview of resource placement to understand the concepts and terminology used in this article.
- You need a Fleet Manager with a hub cluster and member clusters. If you don't have one, see Create an Azure Kubernetes Fleet Manager resource and join member clusters by using the Azure CLI. You must label member clusters appropriately.
- You need access to the Kubernetes API of the hub cluster. If you don't have access, see Access the Kubernetes API for an Azure Kubernetes Fleet Manager hub cluster.
Create a staged update strategy
For this article, create a cluster-scoped rollout strategy that consists of two stages - staging and canary. There's a one-hour wait time after the staging stage, with a before-stage approval for canary.
Creating namespace-scoped strategies (StagedUpdateStrategy) for use with namespace-scope placement (ResourcePlacement) is a similar experience, except you must select the hub cluster namespace from which the staged resources are distributed.
Set the following environment variables for your subscription ID, resource group, and Kubernetes Fleet resource:
export SUBSCRIPTION_ID=<subscription-id> export GROUP=<resource-group-name> export FLEET=<fleet-name>Set the default Azure subscription by using the
az account setcommand:az account set \ --subscription ${SUBSCRIPTION_ID}Get the kubeconfig file of the Kubernetes Fleet hub cluster by using the
az fleet get-credentialscommand:az fleet get-credentials \ --resource-group ${GROUP} \ --name ${FLEET}Your output should look similar to the following.
Merged "hub" as current context in /home/fleet/.kube/configNote
If you receive an error of type
InvalidHubOperationwith the message indicating the fleet is hubless, add a hub cluster. For further information, see upgrade hub cluster type.Save the following YAML as
crp-two-stages-strategy.yaml.apiVersion: placement.kubernetes-fleet.io/v1 kind: ClusterStagedUpdateStrategy metadata: name: two-stages-strategy spec: stages: - name: staging labelSelector: matchLabels: environment: staging afterStageTasks: - type: TimedWait waitTime: 1h - name: canary labelSelector: matchLabels: environment: canary beforeStageTasks: - type: ApprovalApply the placement manifest to the Fleet Manager hub cluster.
kubectl apply -f crp-two-stages-strategy.yamlCheck the status of the strategy resource.
kubectl get clusterstagedupdatestrategy two-stages-strategyYour output should look similar to the following.
NAME AGE two-stages-strategy 47m
In the Azure portal, go to your Fleet Manager.
On the service menu, under Fleet Resources, select Resource placements > Staged rollout strategies, and then select Create.
Note
If you don't see Fleet Resources, your Fleet Manager doesn't have a hub cluster. For further information on how to add one, see upgrade hub cluster type.
Enter a name for the strategy.
Select the Strategy scope, choosing either Cluster-scoped or Namespace-scoped.
- For Namespace-scoped, select the existing Namespace on the Fleet Manager hub cluster where the Kubernetes resources to distribute are staged.
Select Create Stage and enter:
- Stage name - name the stage - it must be unique across all stage names in the strategy.
- (Optional) Stage approvals - select this option if you want to wait for an approval before this stage starts or after it completes.
- (Optional) Wait after stage - select this option if you want to define a pause before moving to the next stage.
- (Optional) Wait duration - select a predefined duration, or enter a custom value in seconds.
- Cluster label selector - choose an existing member cluster label to use to select clusters for this stage.
- (Optional) Cluster ordering label - choose an existing member cluster label to use to order the clusters within the stage.
- (Optional) Stage concurrency - set how many clusters should be updated concurrently in the current stage.
Note
The maximum number of stages in each strategy is 31.
Repeat until you add all stages to the strategy. Select Create to create the strategy.
The page refreshes and the list displays the newly created strategy.
Next steps
In this article, you learned how to define reusable staged rollout strategies for Azure Kubernetes Fleet Manager resource placement. You configured strategy scope, created rollout stages, and added stage controls such as approvals, wait times, label selectors, ordering labels, and concurrency settings.
To learn more about controlling resource rollouts and related concepts, see the following resources: