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
(CRD) to the add-on. Rego is the language that OPA and Gatekeeper support to validate a request to
194
+
the Kubernetes cluster. By supporting an existing standard for Kubernetes management, Azure Policy
195
+
makes it possible to reuse existing rules and pair them with Azure Policy for a unified cloud
196
+
compliance reporting experience. For more information, see
194
197
[What is Rego?](https://www.openpolicyagent.org/docs/latest/policy-language/#what-is-rego).
195
198
196
199
## Built-in policies
197
200
198
-
To find the built-in policies for managing AKS using the Azure portal, follow these steps:
201
+
To find the built-in policies for managing your cluster using the Azure portal, follow these steps:
199
202
200
-
1. Start the Azure Policy service in the Azure portal. Select **All services** in the left pane and
201
-
then search for and select **Policy**.
203
+
1. Start the Azure Policy service in the Azure portal. Select All services in the left pane and then
204
+
search for and select **Policy**.
202
205
203
206
1. In the left pane of the Azure Policy page, select **Definitions**.
204
207
205
-
1. From the Category drop-down list box, use **Select all** to clear the filter and then select
206
-
**Kubernetes service**.
208
+
1. From the Category drop-down list box, use Select all to clear the filter and then select
209
+
**Kubernetes**.
207
210
208
211
1. Select the policy definition, then select the **Assign** button.
209
212
210
-
> [!NOTE]
211
-
> When assigning the Azure Policy for AKS definition, the **Scope** must include the AKS cluster
212
-
> resource.
213
+
1. Set the **Scope** to the management group, subscription, or resource group of the Kubernetes
214
+
cluster where the policy assignment will apply.
215
+
216
+
> [!NOTE]
217
+
> When assigning the Azure Policy for AKS definition, the **Scope** must include the AKS cluster
218
+
> resource.
219
+
220
+
1. Give the policy assignment a **Name** and **Description** that you can use to identify it easily.
221
+
222
+
1. Set the [Policy enforcement](./assignment-structure.md#enforcement-mode) to one of the values
223
+
below.
224
+
225
+
-**Enabled** - Enforce the policy on the cluster. Kubernetes admission requests with violations
226
+
are denied.
227
+
228
+
-**Disabled** - Don't enforce the policy on the cluster. Kubernetes admission requests with
229
+
violations aren't denied. Compliance assessment results are still available. When rolling out
230
+
new policies to running clusters, _Disabled_ option is helpful for testing the policies as
231
+
admission requests with violations aren't denied.
232
+
233
+
1. Select **Next**.
234
+
235
+
1. Set **parameter values**
236
+
237
+
- To exclude Kubernetes namespaces from policy evaluation, specify the list of namespaces in
238
+
parameter **Namespace exclusions**. It's recommended to exclude: _kube-system_
239
+
240
+
1. Select **Review + create**.
213
241
214
242
Alternately, use the [Assign a policy - Portal](../assign-policy-portal.md) quickstart to find and
215
243
assign an AKS policy. Search for a Kubernetes policy definition instead of the sample 'audit vms'.
216
244
217
245
> [!IMPORTANT]
218
-
> Built-in policies in category **Kubernetes service** are only for use with AKS.
246
+
> Built-in policies in category **Kubernetes** are only for use with AKS. For a list of built-in
247
+
> policies, see [../samples/built-in-policies.md#kubernetes]
219
248
220
249
## Logging
221
250
222
251
### Azure Policy Add-on logs
223
252
224
-
As a Kubernetes controller/container, the Azure Policy Add-on keeps logs in the AKS cluster. The
225
-
logs are exposed in the **Insights** page of the AKS cluster. For more information, see
253
+
As a Kubernetes controller/container, both Azure Policy Add-on and Gatekeeper keep logs in the AKS
254
+
cluster. The logs are exposed in the **Insights** page of the AKS cluster. For more information, see
226
255
[Understand AKS cluster performance with Azure Monitor for containers](../../../azure-monitor/insights/container-insights-analyze.md).
227
256
228
-
### Gatekeeper logs
229
-
230
-
To enable Gatekeeper logs for new resource requests, follow the steps in [Enable and review Kubernetes master node logs in AKS](../../../aks/view-master-logs.md).
231
-
Here is an example query to view denied events on new resource requests:
232
-
233
-
```kusto
234
-
| where Category == "kube-audit"
235
-
| where log_s contains "admission webhook"
236
-
| limit 100
237
-
```
238
-
239
-
To view logs from Gatekeeper containers, follow the steps in [Enable and review Kubernetes master node logs in AKS](../../../aks/view-master-logs.md)
240
-
and check the _kube-apiserver_ option in the **Diagnostic settings** pane.
241
-
242
257
## Remove the add-on
243
258
244
259
To remove the Azure Policy Add-on from your AKS cluster, use either the Azure portal or Azure CLI:
0 commit comments