Skip to content

Commit 657c649

Browse files
authored
Merge pull request #208923 from csand-msft/main
New doc for Flux v2 policy
2 parents 7fb4f88 + 7bce3af commit 657c649

File tree

3 files changed

+90
-14
lines changed

3 files changed

+90
-14
lines changed

articles/azure-arc/kubernetes/toc.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,15 @@
7979
href: azure-rbac.md
8080
- name: Deploy applications to cluster
8181
items:
82+
- name: GitOps (Flux v2)
83+
items:
84+
- name: At-scale deployment of Flux v2 configurations using Azure Policy
85+
href: use-azure-policy-flux-2.md
8286
- name: GitOps (Flux v1)
8387
items:
8488
- name: Deploy Helm charts using GitOps (Flux v1)
8589
href: use-gitops-with-helm.md
86-
- name: At-scale deployment of configurations using Azure Policy (Flux v1)
90+
- name: At-scale deployment of Flux v1 configurations using Azure Policy
8791
href: use-azure-policy.md
8892
- name: Manage your cluster
8993
items:
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: "Apply Flux v2 configurations at-scale using Azure Policy"
3+
services: azure-arc, container-service
4+
ms.date: 8/23/2022
5+
ms.topic: how-to
6+
description: "Apply Flux v2 configurations at-scale using Azure Policy"
7+
keywords: "Kubernetes, K8s, Arc, AKS, Azure, containers, GitOps, Flux v2, policy"
8+
---
9+
10+
# Apply Flux v2 configurations at-scale using Azure Policy
11+
12+
You can use Azure Policy to apply Flux v2 configurations (`Microsoft.KubernetesConfiguration/fluxConfigurations` resource type) at scale on Azure Arc-enabled Kubernetes (`Microsoft.Kubernetes/connectedClusters`) or AKS (`Microsoft.ContainerService/managedClusters`) clusters.
13+
14+
To use Azure Policy, select a built-in policy definition and create a policy assignment. You can search for **flux** to find all of the Flux v2 policy definitions. When creating the policy assignment:
15+
1. Set the scope for the assignment.
16+
* The scope will be all resource groups in a subscription or management group or specific resource groups.
17+
2. Set the parameters for the Flux v2 configuration that will be created.
18+
19+
Once the assignment is created, the Azure Policy engine identifies all Azure Arc-enabled Kubernetes clusters located within the scope and applies the GitOps configuration to each cluster.
20+
21+
To enable separation of concerns, you can create multiple policy assignments, each with a different Flux v2 configuration pointing to a different source. For example, one git repository may be used by cluster admins and other repositories may be used by application teams.
22+
23+
> [!TIP]
24+
> There are built-in policy definitions for these scenarios:
25+
> * Flux extension install (required for all scenarios): `Configure installation of Flux extension on Kubernetes cluster`
26+
> * Flux configuration using public Git repository (generally a test scenario): `Configure Kubernetes clusters with Flux v2 configuration using public Git repository`
27+
> * Flux configuration using private Git repository with SSH auth: `Configure Kubernetes clusters with Flux v2 configuration using Git repository and SSH secrets`
28+
> * Flux configuration using private Git repository with HTTPS auth: `Configure Kubernetes clusters with Flux v2 configuration using Git repository and HTTPS secrets`
29+
> * Flux configuration using private Git repository with HTTPS CA cert auth: `Configure Kubernetes clusters with Flux v2 configuration using Git repository and HTTPS CA Certificate`
30+
> * Flux configuration using private Git repository with local K8s secret: `Configure Kubernetes clusters with Flux v2 configuration using Git repository and local secrets`
31+
> * Flux configuration using private Bucket source and KeyVault secrets: `Configure Kubernetes clusters with Flux v2 configuration using Bucket source and secrets in KeyVault`
32+
> * Flux configuration using private Bucket source and local K8s secret: `Configure Kubernetes clusters with specified Flux v2 Bucket source using local secrets`
33+
34+
## Prerequisite
35+
36+
Verify you have `Microsoft.Authorization/policyAssignments/write` permissions on the scope (subscription or resource group) where you'll create this policy assignment.
37+
38+
## Create a policy assignment
39+
40+
1. In the Azure portal, navigate to **Policy**.
41+
1. In the **Authoring** section of the sidebar, select **Definitions**.
42+
1. In the "Kubernetes" category, choose the "Configure Kubernetes clusters with specified GitOps configuration using no secrets" built-in policy definition.
43+
1. Select **Assign**.
44+
1. Set the **Scope** to the management group, subscription, or resource group to which the policy assignment will apply.
45+
* If you want to exclude any resources from the policy assignment scope, set **Exclusions**.
46+
1. Give the policy assignment an easily identifiable **Name** and **Description**.
47+
1. Ensure **Policy enforcement** is set to **Enabled**.
48+
1. Select **Next**.
49+
1. Set the parameter values to be used while creating the `fluxConfigurations` resource.
50+
* For more information about parameters, see the [tutorial on deploying Flux v2 configurations](./tutorial-use-gitops-flux2.md).
51+
1. Select **Next**.
52+
1. Enable **Create a remediation task**.
53+
1. Verify **Create a managed identity** is checked, and that the identity will have **Contributor** permissions.
54+
* For more information, see the [Create a policy assignment quickstart](../../governance/policy/assign-policy-portal.md) and the [Remediate non-compliant resources with Azure Policy article](../../governance/policy/how-to/remediate-resources.md).
55+
1. Select **Review + create**.
56+
57+
After creating the policy assignment, the configuration is applied to new Azure Arc-enabled Kubernetes or AKS clusters created within the scope of policy assignment.
58+
59+
For existing clusters, you may need to manually run a remediation task. This task typically takes 10 to 20 minutes for the policy assignment to take effect.
60+
61+
## Verify a policy assignment
62+
63+
1. In the Azure portal, navigate to one of your Azure Arc-enabled Kubernetes or AKS clusters.
64+
1. In the **Settings** section of the sidebar, select **GitOps**.
65+
* In the configurations list, you should see the configuration created by the policy assignment.
66+
1. In the **Kubernetes resources** section of the sidebar, select **Namespaces** and **Workloads**.
67+
* You should see the namespace and artifacts that were created by the Flux configuration.
68+
* You should see the objects described by the manifests in the Git repo deployed on the cluster.
69+
70+
## Next steps
71+
72+
[Set up Azure Monitor for Containers with Azure Arc-enabled Kubernetes clusters](../../azure-monitor/containers/container-insights-enable-arc-enabled-clusters.md).

articles/azure-arc/kubernetes/use-azure-policy.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
---
2-
title: "Apply configurations at-scale using Azure Policy"
2+
title: "Apply Flux v1 configurations at-scale using Azure Policy"
33
services: azure-arc
44
ms.service: azure-arc
55
#ms.subservice: azure-arc-kubernetes coming soon
6-
ms.date: 11/23/2021
6+
ms.date: 8/23/2022
77
ms.topic: how-to
8-
description: "Apply configurations at-scale using Azure Policy"
9-
keywords: "Kubernetes, Arc, Azure, K8s, containers"
8+
description: "Apply Flux v1 configurations at-scale using Azure Policy"
9+
keywords: "Kubernetes, Arc, Azure, K8s, containers, GitOps, Flux v1, policy"
1010
---
1111

12-
# Apply configurations at-scale using Azure Policy
12+
# Apply Flux v1 configurations at-scale using Azure Policy
1313

14-
You can use Azure Policy to apply configurations (`Microsoft.KubernetesConfiguration/sourceControlConfigurations` resource type) at scale on Azure Arc-enabled Kubernetes clusters (`Microsoft.Kubernetes/connectedclusters`).
14+
You can use Azure Policy to apply Flux v1 configurations (`Microsoft.KubernetesConfiguration/sourceControlConfigurations` resource type) at scale on Azure Arc-enabled Kubernetes clusters (`Microsoft.Kubernetes/connectedclusters`).
1515

16-
>[!NOTE]
17-
>The built-in policies referenced in this article are for GitOps with Flux v1.
16+
> [!NOTE]
17+
> This article is for GitOps with Flux v1. GitOps with Flux v2 is now available for Azure Arc-enabled Kubernetes and Azure Kubernetes Service (AKS) clusters; [go to the article for using policy with Flux v2](./use-azure-policy-flux-2.md). Eventually Azure will stop supporting GitOps with Flux v1, so begin using Flux v2 as soon as possible.
1818
1919
To use Azure Policy, select a built-in GitOps policy definition and create a policy assignment. When creating the policy assignment:
2020
1. Set the scope for the assignment.
@@ -40,13 +40,13 @@ Verify you have `Microsoft.Authorization/policyAssignments/write` permissions on
4040
1. In the Azure portal, navigate to **Policy**.
4141
1. In the **Authoring** section of the sidebar, select **Definitions**.
4242
1. In the "Kubernetes" category, choose the "Configure Kubernetes clusters with specified GitOps configuration using no secrets" built-in policy definition.
43-
1. Click on **Assign**.
43+
1. Select **Assign**.
4444
1. Set the **Scope** to the management group, subscription, or resource group to which the policy assignment will apply.
4545
* If you want to exclude any resources from the policy assignment scope, set **Exclusions**.
4646
1. Give the policy assignment an easily identifiable **Name** and **Description**.
4747
1. Ensure **Policy enforcement** is set to **Enabled**.
4848
1. Select **Next**.
49-
1. Set the parameter values to be used while creating the `sourceControlConfiguration`.
49+
1. Set the parameter values to be used while creating the `sourceControlConfigurations` resource.
5050
* For more information about parameters, see the [tutorial on deploying GitOps configurations](./tutorial-use-gitops-connected-cluster.md).
5151
1. Select **Next**.
5252
1. Enable **Create a remediation task**.
@@ -65,9 +65,9 @@ For existing clusters, you may need to manually run a remediation task. This tas
6565
* In the list, you should see the policy assignment that you created earlier with the **Compliance state** set as *Compliant*.
6666
1. In the **Settings** section of the sidebar, select **GitOps**.
6767
* In the configurations list, you should see the configuration created by the policy assignment.
68-
1. Use `kubectl` to interrogate the cluster.
69-
* You should see the namespace and artifacts that were created by the GitOps configuration.
70-
* You should see the objects described by the manifests in the Git repo getting deployed on the cluster.
68+
1. In the **Kubernetes resources** section of the sidebar, select **Namespaces** and **Workloads**.
69+
* You should see the namespace and artifacts that were created by the Flux configuration.
70+
* You should see the objects described by the manifests in the Git repo deployed on the cluster.
7171

7272
## Next steps
7373

0 commit comments

Comments
 (0)