You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -17,7 +15,10 @@ GitOps with Flux v2 can be enabled in Azure Kubernetes Service (AKS) managed clu
17
15
18
16
This tutorial describes how to use GitOps in a Kubernetes cluster. Before you dive in, take a moment to [learn how GitOps with Flux works conceptually](./conceptual-gitops-flux2.md).
19
17
20
-
General availability of Azure Arc-enabled Kubernetes includes GitOps with Flux v1. The public preview of GitOps with Flux v2, documented here, is available in both Azure Arc-enabled Kubernetes and AKS. Flux v2 is the way forward, and Flux v1 will eventually be deprecated.
18
+
General availability of Azure Arc-enabled Kubernetes includes GitOps with Flux v1. The public preview of GitOps with Flux v2, documented here, is available in both AKS and Azure Arc-enabled Kubernetes. Flux v2 is the way forward, and Flux v1 will eventually be deprecated.
19
+
20
+
>[!IMPORTANT]
21
+
>GitOps with Flux v2 is in public preview. In preparation for general availability, features are still being added to the preview. One important feature, multi-tenancy, could be a breaking change for some users. To prepare yourself for the release of multi-tenancy, [please review these details](#multi-tenancy).
21
22
22
23
## Prerequisites
23
24
@@ -40,34 +41,32 @@ To manage GitOps through the Azure CLI or the Azure portal, you need the followi
40
41
* Read and write permissions on the `Microsoft.ContainerService/managedClusters` resource type.
41
42
* Registration of your subscription with the `AKS-ExtensionManager` feature flag. Use the following command:
42
43
43
-
```azurecli
44
+
```console
44
45
az feature register --namespace Microsoft.ContainerService --name AKS-ExtensionManager
45
46
```
46
47
47
48
### Common to both cluster types
48
49
49
50
* Azure CLI version 2.15 or later. [Install the Azure CLI](/cli/azure/install-azure-cli) or use the following commands to update to the latest version:
50
51
51
-
```azurecli
52
+
```console
52
53
az version
53
54
az upgrade
54
55
```
55
56
56
57
* Registration of the following Azure service providers. (It's OK to re-register an existing provider.)
57
58
58
-
```azurecli
59
+
```console
59
60
az provider register --namespace Microsoft.Kubernetes
60
61
az provider register --namespace Microsoft.ContainerService
61
62
az provider register --namespace Microsoft.KubernetesConfiguration
62
63
```
63
64
64
65
Registration is an asynchronous process and should finish within 10 minutes. Use the following code to monitor the registration process:
65
66
66
-
```azurecli
67
+
```console
67
68
az provider show -n Microsoft.KubernetesConfiguration -o table
You can delete the Flux configuration by using the following command. This action deletes both the `fluxConfigurations` resource in Azure and the Flux configuration objects in the cluster. Because the Flux configuration was originally created with the `prune=true` parameter for the kustomization, all of the objects created in the cluster based on manifests in the Git repository will be removed when the Flux configuration is removed.
@@ -592,7 +585,7 @@ The `source`, `helm`, `kustomize`, and `notification` Flux controllers are insta
592
585
593
586
Here's an example for including the [Flux image-reflector and image-automation controllers](https://fluxcd.io/docs/components/image/). If the Flux extension was created automatically when a Flux configuration was first created, the extension name will be `flux`.
594
587
595
-
```azurecli
588
+
```console
596
589
az k8s-extension create -g <cluster_resource_group> -c <cluster_name> -t <connectedClusters or managedClusters> --name flux --extension-type microsoft.flux --config image-automation-controller.enabled=true image-reflector-controller.enabled=true
597
590
```
598
591
@@ -602,11 +595,9 @@ For a description of all parameters that Flux supports, see the [official Flux d
602
595
603
596
You can see the full list of parameters that the `k8s-configuration flux` CLI command supports by using the `-h` parameter:
604
597
605
-
```azurecli
598
+
```console
606
599
az k8s-configuration flux -h
607
-
```
608
600
609
-
```output
610
601
Group
611
602
az k8s-configuration flux : Commands to manage Flux v2 Kubernetes configurations.
612
603
This command group is in preview and under development. Reference and support levels:
@@ -627,11 +618,9 @@ Commands:
627
618
628
619
Here are the parameters for the `k8s-configuration flux create` CLI command:
629
620
630
-
```azurecli
621
+
```console
631
622
az k8s-configuration flux create -h
632
-
```
633
623
634
-
```output
635
624
This command is from the following extension: k8s-configuration
>If you need Flux to access the source through your proxy, you'll need to update the Azure Arc agents with the proxy settings. For more information, see [Connect using an outbound proxy server](./quickstart-connect-cluster.md?tabs=azure-cli#connect-using-an-outbound-proxy-server).
843
+
>If you need Flux to access the source through your proxy, you'll need to update the Azure Arc agents with the proxy settings. For more information, see [Connect using an outbound proxy server](./quickstart-connect-cluster.md?tabs=azure-cli-connect-using-an-outbound-proxy-server).
855
844
856
845
### Git implementation
857
846
@@ -883,11 +872,9 @@ By using `az k8s-configuration flux create`, you can create one or more kustomiz
883
872
884
873
You can also use `az k8s-configuration flux kustomization` to create, update, list, show, and delete kustomizations in a Flux configuration:
885
874
886
-
```azurecli
875
+
```console
887
876
az k8s-configuration flux kustomization -h
888
-
```
889
877
890
-
```output
891
878
Group
892
879
az k8s-configuration flux kustomization : Commands to manage Kustomizations associated with Flux
893
880
v2 Kubernetes configurations.
@@ -904,11 +891,9 @@ Commands:
904
891
905
892
Here are the kustomization creation options:
906
893
907
-
```azurecli
894
+
```console
908
895
az k8s-configuration flux kustomization create -h
909
-
```
910
896
911
-
```output
912
897
This command is from the following extension: k8s-configuration
913
898
914
899
Command
@@ -1010,13 +995,120 @@ spec:
1010
995
1011
996
By using this annotation, the HelmRelease that is deployed will be patched with the reference to the configured source. Note that only GitRepository source is supported for this currently.
1012
997
998
+
## Multi-tenancy
999
+
1000
+
Flux v2 supports [multi-tenancy](https://github.com/fluxcd/flux2-multi-tenancy). This capability will be integrated into Azure GitOps with Flux v2 prior to general availability.
1001
+
1002
+
>[!NOTE]
1003
+
>This will be a breaking change if you have any cross-namespace sourceRef for HelmRelease, Kustomization, ImagePolicy, or other objects. To prepare for the release of this multi-tenancy feature, take one of these actions:
1004
+
>
1005
+
>* (Recommended) Assure that all sourceRef are to objects within the same namespace as the GitOps configuration.
1006
+
>* If you need time to migrate, you can opt-out of multi-tenancy.
1007
+
1008
+
### Update manifests for multi-tenancy
1009
+
1010
+
Let’s say we deploy a `fluxConfiguration` to one of our Kubernetes clusters in the **cluster-config** namespace with cluster scope. We configure the source to sync the https://github.com/fluxcd/flux2-kustomize-helm-example repo. This is the same sample Git repo used in the tutorial earlier in this doc. After Flux syncs the repo, it will deploy the resources described in the manifests (yamls). Two of the manifests describe HelmRelease and HelmRepository objects.
By default, the Flux extension will deploy the `fluxConfigurations` by impersonating the **flux-applier** service account that is deployed only in the **cluster-config** namespace. Using the above manifests, when multi-tenancy is enabled the HelmRelease would be blocked. This is because the HelmRelease is in the **nginx** namespace and is referencing a HelmRepository in the **flux-system** namespace. Also, the Flux helm-controller cannot apply the HelmRelease, because there is no **flux-applier** service account in the **nginx** namespace.
1051
+
1052
+
To work with multi-tenancy, the correct approach is to deploy all Flux objects into the same namespace as the `fluxConfigurations`. This avoids the cross-namespace reference issue, and allows the Flux controllers to get the permissions to apply the objects. Thus, for a GitOps configuration created in the **cluster-config** namespace, the above manifests would change to these:
Multi-tenancy will be enabled by default to assure security by default in your clusters. However, if you need to disable multi-tenancy, you can opt out by creating or updating the `microsoft.flux` extension in your clusters with "--configuration-settings multiTenancy.enforce=false".
1096
+
1097
+
```console
1098
+
az k8s-extension create --extension-type microsoft.flux --configuration-settings multiTenancy.enforce=false -c CLUSTER_NAME -g RESOURCE_GROUP -n flux -t <managedClusters or connectedClusters>
1099
+
1100
+
or
1101
+
1102
+
az k8s-extension update --configuration-settings multiTenancy.enforce=false -c CLUSTER_NAME -g RESOURCE_GROUP -n flux -t <managedClusters or connectedClusters>
1103
+
```
1104
+
1013
1105
## Migrate from Flux v1
1014
1106
1015
1107
If you've been using Flux v1 in Azure Arc-enabled Kubernetes or AKS clusters and want to migrate to using Flux v2 in the same clusters, you first need to delete the Flux v1 `sourceControlConfigurations` from the clusters. The `microsoft.flux` cluster extension won't be installed if there are `sourceControlConfigurations` resources installed in the cluster.
1016
1108
1017
1109
Use these az CLI commands to find and then delete existing `sourceControlConfigurations` in a cluster:
1018
1110
1019
-
```azurecli
1111
+
```console
1020
1112
az k8s-configuration list --cluster-name <Arc or AKS cluster name> --cluster-type <connectedClusters OR managedClusters> --resource-group <resource group name>
1021
1113
az k8s-configuration delete --name <configuration name> --cluster-name <Arc or AKS cluster name> --cluster-type <connectedClusters OR managedClusters> --resource-group <resource group name>
0 commit comments