|
89 | 89 | name: ${CLUSTER_NAME}-user-kubeconfig # NOT ${CLUSTER_NAME}-kubeconfig |
90 | 90 | key: value |
91 | 91 | ``` |
| 92 | + |
| 93 | +### Migrating existing Clusters to AzureASOManagedControlPlane |
| 94 | + |
| 95 | +Existing CAPI Clusters using the AzureManagedControlPlane and associated APIs can be migrated to use the new |
| 96 | +AzureASOManagedControlPlane and its associated APIs. This process relies on CAPZ's ability to |
| 97 | +[adopt](./adopting-clusters#option-1-using-the-new-azureasomanaged-api) existing clusters that may not have |
| 98 | +been created by CAPZ, which comes with some [caveats](./adopting-clusters#caveats) that should be reviewed first. |
| 99 | + |
| 100 | +To migrate one cluster to the ASO-based APIs: |
| 101 | + |
| 102 | +1. Pause the cluster by setting the Cluster's `spec.paused` to `true`. |
| 103 | +1. Wait for the cluster to be paused by waiting for the _absence_ of the `clusterctl.cluster.x-k8s.io/block-move` |
| 104 | + annotation on the AzureManagedControlPlane and its AzureManagedMachinePools. This should be fairly instantaneous. |
| 105 | +1. Create a new namespace to contain the new resources to avoid conflicting ASO definitions. |
| 106 | +1. [Adopt](./adopting-clusters#option-1-using-the-new-azureasomanaged-api) the underlying AKS resources from |
| 107 | + the new namespace, which creates the new CAPI and CAPZ resources. |
| 108 | +1. Forcefully delete the old Cluster. This is more complicated than normal because CAPI controllers do not reconcile |
| 109 | + paused resources at all, even when they are deleted. The underlying Azure resources will not be affected. |
| 110 | + - Delete the cluster: `kubectl delete cluster <name> --wait=false` |
| 111 | + - Delete the cluster infrastructure object: `kubectl delete azuremanagedcluster <name> --wait=false` |
| 112 | + - Delete the cluster control plane object: `kubectl delete azuremanagedcontrolplane <name> --wait=false` |
| 113 | + - Delete the machine pools: `kubectl delete machinepool <names...> --wait=false` |
| 114 | + - Delete the machine pool infrastructure resources: `kubectl delete azuremanagedmachinepool <names...> --wait=false` |
| 115 | + - Remove finalizers from the machine pool infrastructure resources: `kubectl patch azuremanagedmachinepool <names...> --type merge -p '{"metadata": {"finalizers": null}}'` |
| 116 | + - Remove finalizers from the machine pools: `kubectl patch machinepool <names...> --type merge -p '{"metadata": {"finalizers": null}}'` |
| 117 | + - Remove finalizers from the cluster control plane object: `kubectl patch azuremanagedcontrolplane <name> --type merge -p '{"metadata": {"finalizers": null}}'` |
| 118 | + - Note: the cluster infrastructure object should not have any finalizers and should already be deleted |
| 119 | + - Remove finalizers from the cluster: `kubectl patch cluster <name> --type merge -p '{"metadata": {"finalizers": null}}'` |
| 120 | + - Verify the old ASO resources like ResourceGroup and ManagedCluster managed by the old Cluster are deleted. |
0 commit comments