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
[Azure Policy for Kubernetes](./policy-for-kubernetes.md) makes it possible to manage and report on the compliance state of your Kubernetes clusters from one place.
211
+
212
+
This article describes how to [create](#create-azure-policy-extension), [show extension status](#show-azure-policy-extension), and [delete](#delete-azure-policy-extension) the Azure Policy for Kubernetes extension.
213
+
214
+
For an overview of the extensions platform, see [Azure Arc cluster extensions](/azure/azure-arc/kubernetes/conceptual-extensions).
215
+
216
+
### Prerequisites
217
+
218
+
> Note: If you have already deployed Azure Policy for Kubernetes on an Azure Arc cluster using Helm directly without extensions, follow the instructions listed to [delete the Helm chart](#remove-the-add-on-from-azure-arc-enabled-kubernetes). Once the deletion is done, you can then proceed.
219
+
1. Ensure your Kubernetes cluster is a supported distribution.
220
+
221
+
> Note: Azure Policy for Arc extension is supported on [the following Kubernetes distributions](/azure-arc/kubernetes/conceptual-extensions).
222
+
1. Ensure you have met all the common prerequisites for Kubernetes extensions listed [here](/azure/azure-arc/kubernetes/extensions) including [connecting your cluster to Azure Arc](/azure/azure-arc/kubernetes/quickstart-connect-cluster?tabs=azure-cli).
223
+
224
+
> Note: Azure Policy extension is supported for Arc enabled Kubernetes clusters [in these regions](https://azure.microsoft.com/global-infrastructure/services/?products=azure-arc).
225
+
1. Open ports for the Azure Policy extension. The Azure Policy extension uses these domains and ports to fetch policy
226
+
definitions and assignments and report compliance of the cluster back to Azure Policy.
227
+
228
+
|Domain |Port |
229
+
|---|---|
230
+
|`data.policy.core.windows.net`|`443`|
231
+
|`store.policy.core.windows.net`|`443`|
232
+
|`login.windows.net`|`443`|
233
+
|`dc.services.visualstudio.com`|`443`|
234
+
235
+
1. Before installing the Azure Policy extension or enabling any of the service features, your subscription must enable the **Microsoft.PolicyInsights** resource providers.
236
+
> Note: To enable the resource provider, follow the steps in
237
+
[Resource providers and types](/azure/azure-resource-manager/management/resource-providers-and-types#azure-portal)
238
+
or run either the Azure CLI or Azure PowerShell command:
239
+
- Azure CLI
240
+
241
+
```azurecli-interactive
242
+
# Log in first with az login if you're not using Cloud Shell
243
+
# Provider register: Register the Azure Policy provider
244
+
az provider register --namespace 'Microsoft.PolicyInsights'
245
+
```
246
+
247
+
- Azure PowerShell
248
+
249
+
```azurepowershell-interactive
250
+
# Log in first with Connect-AzAccount if you're not using Cloud Shell
251
+
252
+
# Provider register: Register the Azure Policy provider
## <aname="install-azure-policy-add-on-for-azure-arc-enabled-kubernetes"></a>Install Azure Policy Add-on Using Helm for Azure Arc enabled Kubernetes (preview)
349
+
350
+
> [!NOTE]
351
+
> Azure Policy Add-on Helm model will soon begin deprecation. Please opt for the [Azure Policy Extension for Azure Arc enabled Kubernetes](#install-azure-policy-extension-for-azure-arc-enabled-kubernetes) instead.
210
352
211
353
Before installing the Azure Policy Add-on or enabling any of the service features, your subscription
212
354
must enable the **Microsoft.PolicyInsights** resource provider and create a role assignment for the
213
355
cluster service principal.
214
356
215
357
1. You need the Azure CLI version 2.12.0 or later installed and configured. Run `az --version` to
216
358
find the version. If you need to install or upgrade, see
217
-
[Install the Azure CLI](/cli/azure/install-azure-cli).
359
+
[Install the Azure CLI](../../../azure-resource-manager/management/resource-providers-and-types.md#azure-cli).
218
360
219
361
1. To enable the resource provider, follow the steps in
220
362
[Resource providers and types](../../../azure-resource-manager/management/resource-providers-and-types.md#azure-portal)
@@ -328,12 +470,16 @@ kubectl get pods -n gatekeeper-system
328
470
329
471
## <aname="install-azure-policy-add-on-for-aks-engine"></a>Install Azure Policy Add-on for AKS Engine (preview)
330
472
473
+
> Note: Azure Policy Add-on for AKS Engine is soon to begin deprecation. We recommend that you install the [Azure Policy Extension using Arc-enabled Kubernetes](#install-azure-policy-extension-for-azure-arc-enabled-kubernetes) instead.
474
+
475
+
1. Ensure your Kubernetes cluster is a supported distribution.
476
+
331
477
Before installing the Azure Policy Add-on or enabling any of the service features, your subscription
332
478
must enable the **Microsoft.PolicyInsights** resource provider and create a role assignment for the
333
479
cluster service principal.
334
480
335
481
1. You need the Azure CLI version 2.0.62 or later installed and configured. Run `az --version` to
336
-
find the version. If you need to install or upgrade, see [Install the Azure CLI](/cli/azure/install-azure-cli).
482
+
find the version. If you need to install or upgrade, see [Install the Azure CLI](../../../azure-resource-manager/management/resource-providers-and-types.md#azure-cli).
337
483
338
484
1. To enable the resource provider, follow the steps in
339
485
[Resource providers and types](../../../azure-resource-manager/management/resource-providers-and-types.md#azure-portal)
@@ -649,7 +795,7 @@ Constraint templates that start with `k8sazure` are the ones installed by the ad
649
795
### Get Azure Policy mappings
650
796
651
797
To identify the mapping between a constraint template downloaded to the cluster and the policy
652
-
definition, use `kubectl get constrainttemplates <TEMPLATE> -o yaml`. The results look similiar to
798
+
definition, use `kubectl get constrainttemplates <TEMPLATE> -o yaml`. The results look similar to
653
799
the following output:
654
800
655
801
```yaml
@@ -677,13 +823,13 @@ install on the cluster.
677
823
Once you have the names of the
678
824
[add-on downloaded constraint templates](#view-the-add-on-constraint-templates), you can use the
679
825
name to see the related constraints. Use `kubectl get <constraintTemplateName>` to get the list.
680
-
Constraints installed by the add-on start wtih `azurepolicy-`.
826
+
Constraints installed by the add-on start with `azurepolicy-`.
681
827
682
828
### View constraint details
683
829
684
830
The constraint has details about violations and mappings to the policy definition and assignment. To
685
831
see the details, use `kubectl get <CONSTRAINT-TEMPLATE> <CONSTRAINT> -o yaml`. The results look
686
-
similiar to the following output:
832
+
similar to the following output:
687
833
688
834
```yaml
689
835
apiVersion: constraints.gatekeeper.sh/v1beta1
@@ -727,6 +873,13 @@ For more information about troubleshooting the Add-on for Kubernetes, see the
0 commit comments