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
Copy file name to clipboardExpand all lines: articles/governance/policy/concepts/policy-for-kubernetes.md
+33-32Lines changed: 33 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,23 +12,23 @@ author: davidsmatlak
12
12
Azure Policy extends [Gatekeeper](https://open-policy-agent.github.io/gatekeeper) v3, an _admission
13
13
controller webhook_ for [Open Policy Agent](https://www.openpolicyagent.org/) (OPA), to apply at-scale enforcements and safeguards on your cluster components in a centralized, consistent manner. Cluster components include pods, containers, and namespaces.
14
14
15
-
Azure Policy makes it possible to manage and report on the compliance state of your Kubernetes cluster components from one place. By using Azure Policy's Add-On or Extension, governing your cluster components is enhanced with Azure Policy features, like the ability to use [selectors](./assignment-structure.md#resource-selectors-preview) and [overrides](./assignment-structure.md#overrides-preview) for safe policy rollout and rollback.
15
+
Azure Policy makes it possible to manage and report on the compliance state of your Kubernetes cluster components from one place. By using Azure Policy's Add-On or Extension, governing your cluster components is enhanced with Azure Policy features, like the ability to use [selectors](./assignment-structure.md#resource-selectors-preview) and [overrides](./assignment-structure.md#overrides-preview) for safe policy rollout and rollback.
16
16
17
17
Azure Policy for Kubernetes supports the following cluster environments:
18
18
19
-
-[Azure Kubernetes Service (AKS)](../../../aks/intro-kubernetes.md), through **Azure Policy’s **Add-On** for AKS**
20
-
-[Azure Arc enabled Kubernetes](../../../azure-arc/kubernetes/overview.md), through **Azure Policy’s **Extension** for Arc**
19
+
-[Azure Kubernetes Service (AKS)](../../../aks/intro-kubernetes.md), through **Azure Policy's **Add-On** for AKS**
20
+
-[Azure Arc enabled Kubernetes](../../../azure-arc/kubernetes/overview.md), through **Azure Policy's **Extension** for Arc**
21
21
22
22
> [!IMPORTANT]
23
23
> The Azure Policy Add-on Helm model and the add-on for AKS Engine have been _deprecated_. Follow the instructions to [remove the add-ons](#remove-the-add-on).
24
24
25
25
## Overview
26
26
27
-
By installing Azure Policy’s add-on or extension on your Kubernetes clusters, Azure Policy enacts the following functions:
27
+
By installing Azure Policy's add-on or extension on your Kubernetes clusters, Azure Policy enacts the following functions:
28
28
29
-
-Checks with Azure Policy service for policy assignments to the cluster.
30
-
-Deploys policy definitions into the cluster as [constraint template](https://open-policy-agent.github.io/gatekeeper/website/docs/howto/#constraint-templates) and [constraint](https://open-policy-agent.github.io/gatekeeper/website/docs/howto/#constraints) custom resources or as a mutation template resource (depending on policy definition content).
31
-
-Reports auditing and compliance details back to Azure Policy service.
29
+
-Checks with Azure Policy service for policy assignments to the cluster.
30
+
-Deploys policy definitions into the cluster as [constraint template](https://open-policy-agent.github.io/gatekeeper/website/docs/howto/#constraint-templates) and [constraint](https://open-policy-agent.github.io/gatekeeper/website/docs/howto/#constraints) custom resources or as a mutation template resource (depending on policy definition content).
31
+
-Reports auditing and compliance details back to Azure Policy service.
32
32
33
33
To enable and use Azure Policy with your Kubernetes cluster, take the following actions:
34
34
@@ -68,7 +68,7 @@ To enable and use Azure Policy with your Kubernetes cluster, take the following
68
68
1. You need the Azure CLI version 2.12.0 or later installed and configured. Run `az --version` to
69
69
find the version. If you need to install or upgrade, see
70
70
[Install the Azure CLI](../../../azure-resource-manager/management/resource-providers-and-types.md#azure-cli).
71
-
71
+
72
72
1. The AKS cluster must be a [supported Kubernetes version in Azure Kubernetes Service (AKS)](../../../aks/supported-kubernetes-versions.md). Use the following script to validate your AKS
73
73
cluster version:
74
74
@@ -134,9 +134,10 @@ similar to the following output:
134
134
"identity": null
135
135
}
136
136
```
137
-
## <aname="install-azure-policy-extension-for-azure-arc-enabled-kubernetes"></a>Install Azure Policy Extension for Azure Arc enabled Kubernetes
138
137
139
-
[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. With Azure Policy's Extension for Arc-enabled Kubernetes clusters, you can govern your Arc-enabled Kubernetes cluster components, like pods and containers.
138
+
## Install Azure Policy Extension for Azure Arc enabled Kubernetes
139
+
140
+
[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. With Azure Policy's Extension for Arc-enabled Kubernetes clusters, you can govern your Arc-enabled Kubernetes cluster components, like pods and containers.
140
141
141
142
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.
The Azure Policy language structure for managing Kubernetes follows that of existing policy
288
-
definitions. There are sample definition files available to assign in [Azure Policy's built-in policy library](../samples/built-in-policies.md) that can be used to govern your cluster components.
289
+
definitions. There are sample definition files available to assign in [Azure Policy's built-in policy library](../samples/built-in-policies.md) that can be used to govern your cluster components.
289
290
290
291
Azure Policy for Kubernetes also support custom definition creation at the component-level for both Azure Kubernetes Service clusters and Azure Arc-enabled Kubernetes clusters. Constraint template and mutation template samples are available in the [Gatekeeper community library](https://github.com/open-policy-agent/gatekeeper-library/tree/master). [Azure Policy's VS Code Extension](../how-to/extension-for-vscode.md#create-policy-definition-from-a-constraint-template-or-mutation-template) can be used to help translate an existing constraint template or mutation template to a custom Azure Policy policy definition.
291
292
292
293
With a [Resource Provider mode](./definition-structure.md#resource-provider-modes) of
293
-
`Microsoft.Kubernetes.Data`, the effects [audit](./effects.md#audit), [deny](./effects.md#deny), [disabled](./effects.md#disabled), and [mutate](./effects.md#mutate-preview) are used to manage your Kubernetes clusters.
294
+
`Microsoft.Kubernetes.Data`, the effects [audit](./effects.md#audit), [deny](./effects.md#deny), [disabled](./effects.md#disabled), and [mutate](./effects.md#mutate-preview) are used to manage your Kubernetes clusters.
294
295
295
296
_Audit_ and _deny_ must provide **details** properties
296
297
specific to working with
@@ -574,39 +575,39 @@ For Azure Policy related issues, go to:
574
575
- [General troubleshooting for Azure Policy on Kubernetes](../troubleshoot/general.md#add-on-for-kubernetes-general-errors)
575
576
576
577
## Azure Policy Add-On for AKS Changelog
577
-
Azure Policy’s Add-On for AKS has a version number that indicates the image version of add-on. As feature support is newly introduced on the Add-On, the version number is increased.
578
+
Azure Policy's Add-On for AKS has a version number that indicates the image version of add-on. As feature support is newly introduced on the Add-On, the version number is increased.
578
579
579
580
This section will help you identify which Add-On version is installed on your cluster and also share a historical table of the Azure Policy Add-On version installed per AKS cluster.
580
581
581
-
### Identify which Add-On version is installed on your cluster
582
+
### Identify which Add-On version is installed on your cluster
582
583
583
584
The Azure Policy Add-On uses the standard [Semantic Versioning](https://semver.org/) schema for each version. To identify the Azure Policy Add-On version being used, you can run the following command:
584
-
`kubectl get pod azure-policy-<unique-pod-identifier> -n kube-system -o json | jq '.spec.containers[0].image'`
585
+
`kubectl get pod azure-policy-<unique-pod-identifier> -n kube-system -o json | jq '.spec.containers[0].image'`
585
586
586
-
To identify the Gatekeeper version that your Azure Policy Add-On is using, you can run the following command:
587
+
To identify the Gatekeeper version that your Azure Policy Add-On is using, you can run the following command:
587
588
`kubectl get pod gatekeeper-controller-<unique-pod-identifier> -n gatekeeper-system -o json | jq '.spec.containers[0].image' `
588
589
589
590
Finally, to identify the AKS cluster version that you are using, follow the linked AKS guidance for this.
590
591
591
592
### Add-On versions available per each AKS cluster version
592
593
593
-
#### 1.2.1
594
-
- Released October 2023
595
-
- Kubernetes 1.25+
594
+
#### 1.2.1
595
+
- Released October 2023
596
+
- Kubernetes 1.25+
596
597
- Gatekeeper 3.13.3
597
598
598
-
#### 1.1.0
599
-
- Released July 2023
600
-
- Kubernetes 1.27+
601
-
- Gatekeeper 3.11.1
599
+
#### 1.1.0
600
+
- Released July 2023
601
+
- Kubernetes 1.27+
602
+
- Gatekeeper 3.11.1
602
603
603
-
#### 1.0.1
604
-
- Released June 2023
605
-
- Kubernetes 1.24+
606
-
- Gatekeeper 3.11.1
604
+
#### 1.0.1
605
+
- Released June 2023
606
+
- Kubernetes 1.24+
607
+
- Gatekeeper 3.11.1
607
608
608
609
#### 1.0.0
609
-
Azure Policy for Kubernetes now supports mutation to remediate AKS clusters at-scale!
610
+
Azure Policy for Kubernetes now supports mutation to remediate AKS clusters at-scale!
610
611
611
612
## Remove the add-on
612
613
@@ -681,11 +682,11 @@ aligns with how the add-on was installed:
681
682
- Maximum number of Non-compliant records per subscription: **1 million**
682
683
- Installations of Gatekeeper outside of the Azure Policy Add-on aren't supported. Uninstall any components installed by a previous Gatekeeper installation before enabling the Azure Policy Add-on.
683
684
- [Reasons for non-compliance](../how-to/determine-non-compliance.md#compliance-reasons) aren't available for the Microsoft.Kubernetes.Data [Resource Provider mode](./definition-structure.md#resource-provider-modes). Use [Component details](../how-to/determine-non-compliance.md#component-details-for-resource-provider-modes).
684
-
- Component-level [exemptions](./exemption-structure.md) aren’t supported for [Resource Provider modes](./definition-structure.md#resource-provider-modes). Parameters support is available in Azure Policy definitions to exclude and include particular namespaces.
685
+
- Component-level [exemptions](./exemption-structure.md) aren't supported for [Resource Provider modes](./definition-structure.md#resource-provider-modes). Parameters support is available in Azure Policy definitions to exclude and include particular namespaces.
685
686
686
687
The following limitations apply only to the Azure Policy Add-on for AKS:
687
-
-[AKS Pod security policy](../../../aks/use-pod-security-policies.md) and the Azure Policy Add-on for AKS can't both be enabled. For more information, see [AKS pod security limitation](../../../aks/use-azure-policy.md).
688
-
-Namespaces automatically excluded by Azure Policy Add-on for evaluation: kube-system and gatekeeper-system.
688
+
-[AKS Pod security policy](../../../aks/use-pod-security-policies.md) and the Azure Policy Add-on for AKS can't both be enabled. For more information, see [AKS pod security limitation](../../../aks/use-azure-policy.md).
689
+
-Namespaces automatically excluded by Azure Policy Add-on for evaluation: kube-system and gatekeeper-system.
689
690
690
691
## Frequently asked questions
691
692
@@ -726,7 +727,7 @@ collected:
726
727
evaluation
727
728
- Number of Gatekeeper policy definitions not installed by Azure Policy Add-on
728
729
729
-
### What are general best practices to keep in mind when installing the Azure Policy Add-On?
730
+
### What are general best practices to keep in mind when installing the Azure Policy Add-On?
730
731
- Use system node pool with CriticalAddonsOnly taint to schedule Gatekeeper pods. For more information, see [Using system node pools](../../../aks/use-system-pools.md#system-and-user-node-pools).
731
732
- Secure outbound traffic from your AKS clusters. For more information, see [Control egress traffic](../../../aks/limit-egress-traffic.md) for cluster nodes.
732
733
- If the cluster has aad-pod-identity enabled, Node Managed Identity (NMI) pods modify the nodes' iptables to intercept calls to the Azure Instance Metadata endpoint. This configuration means any request made to the Metadata endpoint is intercepted by NMI even if the pod doesn't use aad-pod-identity.
0 commit comments