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/defender-for-cloud/kubernetes-workload-protections.md
+40-74Lines changed: 40 additions & 74 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,90 +11,60 @@ ms.date: 03/23/2026
11
11
12
12
Kubernetes data plane hardening helps enforce secure configurations for workloads running in your cluster, such as restricting privileged containers, enforcing resource limits, and limiting network access.
13
13
14
-
In Microsoft Defender for Cloud, data plane hardening is implemented by using [Azure Policy](defender-for-cloud-glossary.md#azure-policy-for-kubernetes) for Kubernetes to evaluate and enforce these configurations. Azure Policy is deployed as part of Defender for Containers automatically when automatic provisioning is enabled. If Azure Policy for Kubernetes is turned off in the Defender for Containers plan settings, you can deploy it by remediating the relevant recommendation.
14
+
In Microsoft Defender for Cloud, data plane hardening is implemented by using [Azure Policy](defender-for-cloud-glossary.md#azure-policy-for-kubernetes) for Kubernetes to evaluate and enforce these configurations. Azure Policy is deployed as part of Defender for Containers when automatic provisioning is enabled.
15
15
16
-
After Azure Policy for Kubernetes is deployed, Defender for Cloud generates data plane hardening recommendations based on your cluster configuration. This page shows how to review these recommendations, configure policy parameters, and enforce them on your clusters.
17
-
18
-
> [!TIP]
19
-
> For a list of the security recommendations that might appear for Kubernetes clusters and nodes, review [container recommendations](recommendations-reference-container.md).
20
-
21
-
## Prerequisites
22
-
23
-
- Add the [Required FQDN/application rules for Azure policy](/azure/aks/outbound-rules-control-egress#azure-policy).
24
-
- (For non AKS clusters) [Connect an existing Kubernetes cluster to Azure Arc](/azure/azure-arc/kubernetes/quickstart-connect-cluster).
25
-
26
-
## Enable Azure Policy for Kubernetes
27
-
28
-
> [!NOTE]
29
-
> When you enable this setting, the Azure Policy for Kubernetes pods are installed on the cluster. Doing so allocates a small amount of CPU and memory for the pods to use. This allocation might reach maximum capacity, but it doesn't affect the rest of the CPU and memory on the resource.
30
-
31
-
### Enable Azure Policy using
32
-
33
-
If you disabled the "Azure Policy for Kubernetes" settings under the containers plan, you can follow the steps below to enable it across all clusters in your subscription:
34
-
35
-
1. Sign in to the [Azure portal](https://portal.azure.com).
36
-
37
-
1. Go to **Microsoft Defender for Cloud** > **Environment settings**.
38
-
39
-
1. Select the relevant subscription.
40
-
41
-
1. On the Defender plans page, ensure that **Containers** is toggled to **On**.
42
-
43
-
1. Select **Settings**.
44
-
45
-
:::image type="content" source="media/kubernetes-workload-protections/containers-settings.png" alt-text="Screenshot showing the settings button in the Defender plan." lightbox="media/kubernetes-workload-protections/containers-settings.png":::
16
+
If Azure Policy for Kubernetes is turned off in the Defender for Containers plan settings, you can deploy it by remediating the relevant recommendation. You can also deploy Azure Policy manually by using [Azure CLI](defender-for-containers-deploy-azure-cli.md) or [Helm](deploy-helm.md) if you didn't use automatic provisioning or if you excluded clusters from automatic provisioning.
46
17
47
-
1. In the Settings & Monitoring page, toggle the **Azure Policy for Kubernetes** to **On**.
18
+
If Azure Policy for Kubernetes is turned off in the Defender for Containers plan settings, you can deploy it by remediating the relevant recommendation. You can also deploy Azure Policy manually by using [Azure CLI](defender-for-containers-deploy-azure-cli.md) or [Helm](deploy-helm.md) if you disabled automatic provisioning during enablement or excluded specific clusters from automatic provisioning.
48
19
49
-
:::image type="content" source="media/kubernetes-workload-protections/toggle-on-extensions.png" alt-text="Screenshot showing the toggles used to enable or disable the extensions." lightbox="media/kubernetes-workload-protections/toggle-on-extensions.png":::
50
-
51
-
#### Enable for GCP projects
52
-
53
-
When you enable Microsoft Defender for Containers on a GCP connector, the "Azure Policy Extension for Azure Arc" setting is enabled by default for the Google Kubernetes Engine in the relevant project. If you disable the setting on initial configuration, you can enable it afterwards manually.
20
+
After Azure Policy for Kubernetes is deployed, Defender for Cloud generates data plane hardening recommendations based on your cluster configuration. This page shows how to review these recommendations, configure policy parameters, and enforce them on your clusters.
54
21
55
-
If you disabled the "Azure Policy Extension for Azure Arc" settings under the GCP connector, you can follow the below steps to [enable it on your GCP connector](defender-for-containers-enable.md?tabs=aks-deploy-portal%2Ck8s-deploy-asc%2Ck8s-verify-asc%2Ck8s-remove-arc%2Caks-removeprofile-api&pivots=defender-for-container-gke&preserve-view=true#enable-the-plan).
22
+
## Prerequisites
56
23
57
-
### Deploy Azure Policy for Kubernetes on existing clusters
24
+
To begin, make sure that:
58
25
59
-
You can manually configure the Azure Policy for Kubernetes on existing Kubernetes clusters through the Recommendations page. Once enabled, the hardening recommendations become available (some of the recommendations require another configuration to work).
26
+
-[Defender for Containers is enabled on your subscription](defender-for-containers-enable-portal.md).
27
+
- You have added the [required FQDN/application rules for Azure policy](/azure/aks/outbound-rules-control-egress#azure-policy).
28
+
- (For non AKS clusters) Your Kubernetes cluster is [connected to Azure Arc](/azure/azure-arc/kubernetes/quickstart-connect-cluster).
60
29
61
-
> [!NOTE]
62
-
> For AWS, onboarding at scale using the connector isn't supported. However, you can install Azure Policy for Kubernetes on all existing clusters or on specific clusters by using the recommendation `Azure Arc-enabled Kubernetes clusters should have the Azure policy extension for Kubernetes extension installed`.
30
+
## Deploy Azure Policy for Kubernetes by remediating recommendations
63
31
64
-
**To deploy the Azure Policy for Kubernetes to specified clusters**:
32
+
If Azure Policy for Kubernetes isn't deployed or was turned off in the Defender for Containers plan settings, you can install it by remediating the relevant recommendation in Defender for Cloud.
65
33
66
34
1. Sign in to the [Azure portal](https://portal.azure.com).
67
35
68
-
1. Go to **Microsoft Defender for Cloud** > **General** > **Recommendations**.
36
+
1. Go to **Microsoft Defender for Cloud** > **Recommendations**.
69
37
70
38
1. Search for the relevant recommendation:
71
39
72
-
-**Azure -**`"Azure Kubernetes Service clusters should have the Azure Policy add-on for Kubernetes installed"`
73
-
-**GCP**- `"GKE clusters should have the Azure Policy extension"`.
74
-
-**AWS and On-premises**- `"Azure Arc-enabled Kubernetes clusters should have the Azure policy extension for Kubernetes extension installed"`.
40
+
-**Azure:** Azure Kubernetes Service clusters should have the Azure Policy add-on for Kubernetes installed
41
+
-**GCP:** GKE clusters should have the Azure Policy extension installed
42
+
-**AWS/Arc-enabled Kubernetes:** Azure Arc-enabled Kubernetes clusters should have the Azure Policy extension installed
75
43
76
44
:::image type="content" source="./media/kubernetes-workload-protections/azure-kubernetes-service-clusters-recommendation.png" alt-text="Screenshot showing the Azure Kubernetes service clusters recommendation." lightbox="media/kubernetes-workload-protections/azure-kubernetes-service-clusters-recommendation.png":::
77
45
78
-
1. Select a found recommendation.
46
+
1. Select a recommendation.
79
47
80
-
1.Select**Fix**.
48
+
1.In the **Take action** tab, select**Fix**.
81
49
82
50
:::image type="content" source="media/kubernetes-workload-protections/azure-kubernetes-service-clusters-recommendation-fix.png" alt-text="Screenshot of a recommendation with the Fix button highlighted." lightbox="media/kubernetes-workload-protections/azure-kubernetes-service-clusters-recommendation-fix.png":::
83
51
84
-
1.Repeat for each additional recommendation.
52
+
1.Select **Fix** to remediate the selected resources.
85
53
86
-
## View and configure the bundle of recommendations
54
+
1. Repeat for each recommendation.
87
55
88
-
After Azure Policy for Kubernetes is deployed, Defender for Cloud evaluates your cluster configuration and generates data plane hardening recommendations. This can take up to 30 minutes.
56
+
## Review data plane hardening recommendations
89
57
90
-
> Microsoft components, such as the Defender sensor, are deployed in the `kube-system` namespace by default and aren't marked as noncompliant. Third-party components installed in other namespaces might be flagged. To exclude specific namespaces, configure policy exclusions.
58
+
After you deploy Azure Policy for Kubernetes Defender for Cloud evaluates your cluster configuration and generates data plane hardening recommendations. This process can take up to 30 minutes.
59
+
60
+
> Microsoft components, such as the Defender sensor, are deployed in the `kube-system` namespace by default and aren't marked as noncompliant. Third-party components installed in other namespaces might be flagged. To exclude specific namespaces, configure Azure policy exclusions.
91
61
92
62
The following table lists common data plane hardening recommendations:
93
63
94
64
| Recommendation name | Security control | Configuration required |
| Container CPU and memory limits should be enforced | Protect applications against DDoS attack |**Yes**|
97
-
| Container images should be deployed only from trusted registries | Remediate vulnerabilities |**Yes**|
67
+
| Container images should be deployed from trusted registries only| Remediate vulnerabilities |**Yes**|
98
68
| Least privileged Linux capabilities should be enforced for containers | Manage access and permissions |**Yes**|
99
69
| Containers should only use allowed AppArmor profiles | Remediate security configurations |**Yes**|
100
70
| Services should listen on allowed ports only | Restrict unauthorized network access |**Yes**|
@@ -112,7 +82,7 @@ The following table lists common data plane hardening recommendations:
112
82
113
83
### Configure policy parameters
114
84
115
-
Some recommendations require parameter configuration to be effective. For example, the recommendation **Container images should be deployed only from trusted registries** requires you to define a list of trusted registries.
85
+
Some recommendations require parameter configuration to be effective. For example, the recommendation **Container images should be deployed from trusted registries only** requires you to define a list of trusted registries.
116
86
117
87
If required parameters aren't configured, resources are shown as unhealthy.
118
88
@@ -128,11 +98,7 @@ To configure policy parameters:
128
98
129
99
:::image type="content" source="media/kubernetes-workload-protections/security-policies-page.png" alt-text="Screenshot of the Security policies page." lightbox="media/kubernetes-workload-protections/security-policies-page.png":::
130
100
131
-
1. On the **Standards** tab, search for the relevant security standard.
132
-
133
-
1. Select the security standard's 3-dot menu and select **Manage**.
134
-
135
-
:::image type="content" source="media/kubernetes-workload-protections/security-policies-select-manage.png" alt-text="Screenshot of selecting Manage from the recommendation's 3-dot menu." lightbox="media/kubernetes-workload-protections/security-policies-select-manage.png":::
101
+
1. On the **Standards** tab, select the relevant security standard.
136
102
137
103
1. Select the relevant policy assignment's 3-dot menu and select **Manage effect and parameters**.
138
104
@@ -156,8 +122,6 @@ To enforce a recommendation:
156
122
157
123
1. Search for and select the relevant data plane hardening recommendation.
158
124
159
-
1. Open the recommendation details page.
160
-
161
125
1. On the **Take action** tab, select **Deny**.
162
126
163
127
:::image type="content" source="./media/kubernetes-workload-protections/enforce-workload-protection-example.png" alt-text="Screenshot showing the Deny option for Azure Policy parameter." lightbox="media/kubernetes-workload-protections/enforce-workload-protection-example.png":::
@@ -174,30 +138,32 @@ To view data plane hardening recommendations for a specific cluster:
174
138
175
139
1. Go to **Defender for Cloud** > **Inventory**.
176
140
177
-
1. Set the resource type filter to **Kubernetes services** and select **Apply**.
141
+
1. Set the resource type filter to **Kubernetes service** and select **Apply**.
178
142
179
143
:::image type="content" source="media/kubernetes-workload-protections/resource-type-kubernetes-service.png" alt-text="Screenshot of using the resource type filter to select kubernetes service." lightbox="media/kubernetes-workload-protections/resource-type-kubernetes-service.png":::
180
144
181
-
1. Select a cluster to investigate.
145
+
1. Select a cluster.
182
146
183
-
1. Review the available recommendations for it. When you view a recommendation from the workload protection set, the number of affected pods ("Kubernetes components") is listed alongside the cluster.
147
+
1. Review the available recommendations. Data plane hardening recommendations show the number of affected Kubernetes components.
184
148
185
-
1.Optional: For a list of the specific pods, select the recommendation.
149
+
1.Select a recommendation to view affected resources.
186
150
187
151
:::image type="content" source="media/kubernetes-workload-protections/resource-health-recommendation.png" alt-text="Screenshot of selecting a recommendation from the Resource health page." lightbox="media/kubernetes-workload-protections/resource-health-recommendation.png":::
188
-
1. and then select **Take action**.
189
152
190
-
:::image type="content" source="./media/defender-for-kubernetes-usage/view-affected-pods-for-recommendation.gif" alt-text="Screenshot showing where to view the affected pods for a Kubernetes recommendation.":::
153
+
1. Select the **Take action** tab to review remediation options.
154
+
155
+
:::image type="content" source="media/kubernetes-workload-protections/take-action-tab.png" alt-text="Use the Take action tab to view remediation steps for a recommendation." lightbox="media/kubernetes-workload-protections/take-action-tab.png":::
191
156
192
-
**To test the enforcement, use the two Kubernetes deployments below**:
157
+
## Test policy enforcement
193
158
194
-
- One is for a healthy deployment, compliant with the bundle of workload protection recommendations.
159
+
You can validate data plane hardening policies by deploying test workloads.
195
160
196
-
- The other is for an unhealthy deployment, noncompliant with *any* of the recommendations.
161
+
- A compliant deployment that meets data plane hardening requirements
162
+
- A noncompliant deployment that violates multiple policies
197
163
198
-
Deploy the example .yaml files as-is, or use them as a reference to remediate your own workload.
164
+
Deploy the following example YAML files to verify that compliant workloads are deployed successfully and noncompliant workloads are flagged or blocked, depending on policy enforcement settings.
0 commit comments