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