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
+56-62Lines changed: 56 additions & 62 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,44 +11,26 @@ 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 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 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.
15
15
16
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
17
18
18
> [!TIP]
19
19
> For a list of the security recommendations that might appear for Kubernetes clusters and nodes, review [container recommendations](recommendations-reference-container.md).
20
20
21
-
## Set up your workload protection
22
-
23
-
Microsoft Defender for Cloud includes a bundle of recommendations that are available once you've installed the **[Azure Policy for Kubernetes](defender-for-cloud-glossary.md#azure-policy-for-kubernetes)**.
24
-
25
21
## Prerequisites
26
22
27
23
- Add the [Required FQDN/application rules for Azure policy](/azure/aks/outbound-rules-control-egress#azure-policy).
28
24
- (For non AKS clusters) [Connect an existing Kubernetes cluster to Azure Arc](/azure/azure-arc/kubernetes/quickstart-connect-cluster).
29
25
30
-
## Enable Kubernetes data plane hardening
31
-
32
-
You can enable the Azure Policy for Kubernetes by one of two ways:
33
-
34
-
- Enable for all current and future clusters using plan/connector settings:
35
-
-[Enabling for Azure subscriptions or on-premises](#enable-for-azure-subscriptions-or-on-premises)
36
-
-[Enabling for Google Cloud Platform (GCP) projects](#enable-for-gcp-projects)
37
-
-[Deploy Azure Policy for Kubernetes on existing clusters](#deploy-azure-policy-for-kubernetes-on-existing-clusters)
38
-
39
-
### Enable Azure Policy for Kubernetes for all current and future clusters using plan/connector settings
26
+
## Enable Azure Policy for Kubernetes
40
27
41
28
> [!NOTE]
42
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.
43
30
44
-
> [!NOTE]
45
-
> Enablement for AWS via the connector isn't supported due to a limitation in EKS that requires the cluster admin to add permissions for a new IAM role on the cluster itself.
46
-
47
-
#### Enable for Azure subscriptions or on-premises
31
+
### Enable Azure Policy using
48
32
49
-
When you enable Microsoft Defender for Containers, the "Azure Policy for Kubernetes" setting is enabled by default for the Azure Kubernetes Service and for Azure Arc-enabled Kubernetes clusters in the relevant subscription. If you disable the setting on initial configuration, you can enable it afterwards manually.
50
-
51
-
If you disabled the "Azure Policy for Kubernetes" settings under the containers plan, you can follow the steps bellow to enable it across all clusters in your subscription:
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:
52
34
53
35
1. Sign in to the [Azure portal](https://portal.azure.com).
54
36
@@ -103,51 +85,50 @@ You can manually configure the Azure Policy for Kubernetes on existing Kubernete
103
85
104
86
## View and configure the bundle of recommendations
105
87
106
-
Approximately 30 minutes after the Azure Policy for Kubernetes installation completes, Defender for Cloud shows the clusters’ health status for the following recommendations, each in the relevant security control as shown:
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.
107
89
108
-
> [!NOTE]
109
-
> If you're installing the Azure Policy for Kubernetes for the first time, these recommendations appear as new additions in the list of recommendations.
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.
110
91
111
-
> [!TIP]
112
-
> Some recommendations have parameters that must be customized via Azure Policy to use them effectively. For example, to benefit from the recommendation **Container images should be deployed only from trusted registries**, you have to define your trusted registries. If you don't enter the necessary parameters for the recommendations that require configuration, your workloads will be shown as unhealthy.
92
+
The following table lists common data plane hardening recommendations:
113
93
114
-
> [!NOTE]
115
-
> Microsoft components like the Defender sensor are deployed in the kube-system namespace by default. This setup ensures they aren't marked as non-compliant in data plane recommendations. However, third-party vendor tools installed in a different namespace might be flagged as non-compliant. To exclude third-party vendors from these recommendations, you can add their namespace to the exclusion list.
116
-
117
-
| 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**|
98
+
| Least privileged Linux capabilities should be enforced for containers | Manage access and permissions |**Yes**|
99
+
| Containers should only use allowed AppArmor profiles | Remediate security configurations |**Yes**|
100
+
| Services should listen on allowed ports only | Restrict unauthorized network access |**Yes**|
101
+
| Usage of host networking and ports should be restricted | Restrict unauthorized network access |**Yes**|
102
+
| Usage of pod HostPath volume mounts should be restricted to a known list | Manage access and permissions |**Yes**|
103
+
| Container with privilege escalation should be avoided | Manage access and permissions | No |
104
+
| Containers sharing sensitive host namespaces should be avoided | Manage access and permissions | No |
105
+
| Immutable (read-only) root filesystem should be enforced for containers | Manage access and permissions | No |
106
+
| Kubernetes clusters should be accessible only over HTTPS | Encrypt data in transit | No |
107
+
| Kubernetes clusters should disable automounting API credentials | Manage access and permissions | No |
108
+
| Kubernetes clusters shouldn't use the default namespace | Implement security best practices | No |
109
+
| Kubernetes clusters shouldn't grant CAP_SYS_ADMIN capabilities | Manage access and permissions | No |
110
+
| Privileged containers should be avoided | Manage access and permissions | No |
111
+
| Running containers as root user should be avoided | Manage access and permissions | No |
112
+
113
+
### Configure policy parameters
114
+
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.
116
+
117
+
If required parameters aren't configured, resources are shown as unhealthy.
118
+
119
+
To configure policy parameters:
139
120
140
121
1. Sign in to the [Azure portal](https://portal.azure.com).
141
122
142
-
1. Go to **Microsoft Defender for Cloud** > **Management** > **Environment settings**.
123
+
1. Go to **Microsoft Defender for Cloud** > **Environment settings**.
143
124
144
125
1. Select the relevant subscription.
145
126
146
-
1.From the navigation menu, select**Security policies**.
127
+
1.Select**Security policies**.
147
128
148
129
:::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":::
149
130
150
-
1. On the **Standards** tab, search for the appropriate security standard.
131
+
1. On the **Standards** tab, search for the relevant security standard.
151
132
152
133
1. Select the security standard's 3-dot menu and select **Manage**.
153
134
@@ -157,23 +138,37 @@ For recommendations with parameters that need to be customized, you need to set
157
138
158
139
:::image type="content" source="media/kubernetes-workload-protections/select-manage-effect-and-parameters.png" alt-text="Screenshot of selecting the 3-dot menu and then selecting Manage effect and aparameters." lightbox="media/kubernetes-workload-protections/select-manage-effect-and-parameters.png":::
159
140
160
-
1.Modify the values as required.
141
+
1.Update the required parameter values.
161
142
162
143
:::image type="content" source="media/kubernetes-workload-protections/manage-effect-and-parameters.png" alt-text="Screenshot of the paraments panel." lightbox="media/kubernetes-workload-protections/manage-effect-and-parameters.png":::
163
144
164
145
1. Select **Save**.
165
146
166
-
**To enforce any of the recommendations**:
147
+
### Enforce data plane hardening policies
148
+
149
+
By default, policies evaluate resources in audit mode. To enforce a policy, set its effect to **Deny**.
150
+
151
+
To enforce a recommendation:
152
+
153
+
1. Sign in to the [Azure portal](https://portal.azure.com).
154
+
155
+
1. Go to **Microsoft Defender for Cloud** > **Recommendations**.
156
+
157
+
1. Search for and select the relevant data plane hardening recommendation.
167
158
168
-
1. Open the recommendation details page and select **Deny**:
159
+
1. Open the recommendation details page.
160
+
161
+
1. Select **Deny**.
169
162
170
163
:::image type="content" source="./media/defender-for-kubernetes-usage/enforce-workload-protection-example.png" alt-text="Screenshot showing the Deny option for Azure Policy parameter." lightbox="media/defender-for-kubernetes-usage/enforce-workload-protection-example.png":::
171
164
172
-
The pane to set the scope opens.
165
+
1. Set the scope.
166
+
167
+
1. Select **Change to deny**.
173
168
174
-
1. Set the scope and select **Change to deny**.
169
+
### View recommendations for a cluster
175
170
176
-
**To see which recommendations apply to your clusters**:
171
+
To view data plane hardening recommendations for a specific cluster:
177
172
178
173
1. Sign in to the [Azure portal](https://portal.azure.com).
179
174
@@ -186,7 +181,6 @@ For recommendations with parameters that need to be customized, you need to set
186
181
1. Select a cluster to investigate.
187
182
188
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.
189
-
190
184
191
185
1. Optional: For a list of the specific pods, select the recommendation.
0 commit comments