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
title: Workload protections for your Kubernetes workloads
3
3
description: Learn how to use Microsoft Defender for Cloud's set of Kubernetes workload protection security recommendations
4
4
ms.topic: how-to
5
-
ms.date: 01/26/2022
5
+
ms.date: 02/15/2022
6
6
---
7
7
8
8
# Protect your Kubernetes workloads
@@ -11,59 +11,102 @@ ms.date: 01/26/2022
11
11
12
12
This page describes how to use Microsoft Defender for Cloud's set of security recommendations dedicated to Kubernetes workload protection.
13
13
14
-
Learn more about these features in [Workload protection best-practices using Kubernetes admission control](defender-for-containers-introduction.md#workload-protection-best-practices-using-kubernetes-admission-control)
15
-
16
-
Defender for Cloud offers more container security features if you enable Microsoft Defender for Containers. Learn more in [Overview of Microsoft Defender for Containers](defender-for-containers-introduction.md)
17
-
18
14
> [!TIP]
19
15
> For a list of the security recommendations that might appear for Kubernetes clusters and nodes, see the [Container recommendations](recommendations-reference.md#container-recommendations) of the recommendations reference table.
| Pricing: | Free for AKS workloads<br>For Azure Arc-enabled Kubernetes or EKS, it's billed according to the Microsoft Defender for Containers plan|
28
-
| Required roles and permissions: |**Owner** or **Security admin** to edit an assignment<br>**Reader** to view the recommendations |
29
-
| Environment requirements: | Kubernetes v1.14 (or newer) is required<br>No PodSecurityPolicy resource (old PSP model) on the clusters<br>Windows nodes are not supported |
30
-
| Clouds:| :::image type="icon" source="./media/icons/yes-icon.png"::: Commercial clouds<br>:::image type="icon" source="./media/icons/yes-icon.png"::: National (Azure Government, Azure China 21Vianet) |
31
-
|||
32
-
19
+
| Aspect | Details |
20
+
|--|--|
21
+
| Release state: | AKS - General availability (GA) <br> Arc enabled Kubernetes - Preview|
22
+
| Pricing: | Free for AKS workloads<br>For Azure Arc-enabled Kubernetes, it's billed according to the Microsoft Defender for Containers plan |
23
+
| Required roles and permissions: |**Owner** or **Security admin** to edit an assignment<br>**Reader** to view the recommendations |
24
+
| Environment requirements: | Kubernetes v1.14 (or newer) is required<br>No PodSecurityPolicy resource (old PSP model) on the clusters<br>Windows nodes are not supported |
25
+
|Azure Clouds: | :::image type="icon" source="./media/icons/yes-icon.png"::: Commercial clouds<br>:::image type="icon" source="./media/icons/yes-icon.png"::: National (Azure Government, Azure China 21Vianet) |
26
+
|Non-Azure Clouds, and On-prem: |supported via Arc enabled Kubernetes.|
27
+
|||
33
28
34
29
## Set up your workload protection
35
30
36
-
Microsoft Defender for Cloud includes a bundle of recommendations that are available when you've installed the **Azure Policy add-on for Kubernetes**.
31
+
Microsoft Defender for Cloud includes a bundle of recommendations that are available once you've installed the **Azure Policy add-on for Kubernetes or extensions**.
37
32
38
33
## Prerequisites
39
34
40
-
Validate the following endpoints are configured for outbound access so that the Azure Policy add-on for Kubernetes can connect to Azure Policy to synchronize Kubernetes policies:
35
+
- Add the [Required FQDN/application rules for Azure policy](../aks/limit-egress-traffic.md#azure-policy).
36
+
- (For non AKS clusters) [Connect an existing Kubernetes cluster to Azure Arc](../azure-arc/kubernetes/quickstart-connect-cluster.md).
37
+
38
+
## Enable Kubernetes workload protection
39
+
40
+
When you enable Microsoft Defender for Containers, Azure Kubernetes Service clusters, and Azure Arc enabled Kubernetes clusters (Preview) protection are both enabled by default. You can configure your Kubernetes workload protections, when you enable Microsoft Defender for Containers.
41
+
42
+
**To enable Azure Kubernetes Service clusters and Azure Arc enabled Kubernetes clusters (Preview)**:
43
+
44
+
1. Sign in to the [Azure portal](https://portal.azure.com).
45
+
46
+
1. Navigate to **Microsoft Defender for Cloud** > **Environment settings**.
47
+
48
+
1. Select the relevant subscription.
49
+
50
+
1. On the Defender plans page, ensure that Containers is toggled to **On**.
51
+
52
+
1. Select **Configure**.
53
+
54
+
:::image type="content" source="media/kubernetes-workload-protections/configure-containers.png" alt-text="Screenshot showing where on the defenders plan to go to to select the configure button.":::
55
+
56
+
1. On the Advanced configuration page, toggle each relevant component to **On**.
57
+
58
+
:::image type="content" source="media/kubernetes-workload-protections/advanced-configuration.png" alt-text="Screenshot showing the toggles used to enable or disable them.":::
41
59
42
-
See [Required FQDN/application rules for Azure policy](../aks/limit-egress-traffic.md#azure-policy) for the required FQDN/application rules.
60
+
1. Select **Save**.
43
61
44
-
### Step 1: Deploy the add-on
62
+
##Configure Defender for Containers components
45
63
46
-
To configure the recommendations, install the **Azure Policy add-on for Kubernetes**.
64
+
If you disabled any of the default protections when you enabled Microsoft Defender for Containers, you can change the configurations and reenable them via auto provisioning.
47
65
48
-
- You can auto deploy this add-on as explained in [Enable auto provisioning of the Log Analytics agent and extensions](enable-data-collection.md#auto-provision-mma). When auto provisioning for the add-on is set to "on", the extension is enabled by default in all existing and future clusters (that meet the add-on installation requirements).
66
+
**To configure the Defender for Containers components**:
49
67
50
-
:::image type="content" source="media/defender-for-kubernetes-usage/policy-add-on-auto-provision.png" alt-text="Using Defender for Cloud's auto provisioning tool to install the policy add-on for Kubernetes":::
68
+
1. Sign in to the [Azure portal](https://portal.azure.com).
51
69
52
-
- To manually deploy the add-on:
70
+
1. Navigate to **Microsoft Defender for Cloud** > **Environment settings**.
53
71
54
-
1.From the recommendations page, search for the recommendation "**Azure Policy add-on for Kubernetes should be installed and enabled on your clusters**".
72
+
1.Select the relevant subscription.
55
73
56
-
:::image type="content" source="./media/defender-for-kubernetes-usage/recommendation-to-install-policy-add-on-for-kubernetes.png" alt-text="Recommendation **Azure Policy add-on for Kubernetes should be installed and enabled on your clusters**":::
74
+
1. From the left side tool bar, select **Auto provisioning**.
57
75
58
-
> [!TIP]
59
-
> The recommendation is included in five different security controls and it doesn't matter which one you select in the next step.
76
+
1. Ensure that Microsoft Defenders for Containers components (preview) is toggled to On.
60
77
61
-
1. From any of the security controls, select the recommendation to see the resources on which you can install the add-on.
62
-
1. Select the relevant cluster, and **Remediate**.
78
+
:::image type="content" source="media/kubernetes-workload-protections/toggled-on.png" alt-text="Screenshot showing that Microsoft Defender for Containers is toggled to on.":::
63
79
64
-
:::image type="content" source="./media/defender-for-kubernetes-usage/recommendation-to-install-policy-add-on-for-kubernetes-details.png" alt-text="Recommendation details page for **Azure Policy add-on for Kubernetes should be installed and enabled on your clusters**":::
80
+
1. Select **Edit configuration**.
65
81
66
-
### Step 2: View and configure the bundle of recommendations
82
+
:::image type="content" source="media/kubernetes-workload-protections/edit-configuration.png" alt-text="Screenshot showing the edit configuration button.":::
83
+
84
+
1. On the Advanced configuration page, toggle each relevant component to **On**.
85
+
86
+
:::image type="content" source="media/kubernetes-workload-protections/toggles.png" alt-text="Screenshot showing each option and the toggles to enable or disable them.":::
87
+
88
+
1. Select **Confirm**.
89
+
90
+
## Deploy the add-on to specified clusters
91
+
92
+
You can manually configure the Kubernetes workload add-on, or extension protection through the Recommendations page. This can be accomplished by remediating the `Azure Policy add-on for Kubernetes should be installed and enabled on your clusters` recommendation.
93
+
94
+
**To Deploy the add-on to specified clusters**:
95
+
96
+
1. From the recommendations page, search for the recommendation `Azure Policy add-on for Kubernetes should be installed and enabled on your clusters`.
97
+
98
+
:::image type="content" source="./media/defender-for-kubernetes-usage/recommendation-to-install-policy-add-on-for-kubernetes.png" alt-text="Recommendation **Azure Policy add-on for Kubernetes should be installed and enabled on your clusters**.":::
99
+
100
+
> [!TIP]
101
+
> The recommendation is included in five different security controls and it doesn't matter which one you select in the next step.
102
+
103
+
1. From any of the security controls, select the recommendation to see the resources on which you can install the add-on.
104
+
105
+
1. Select the relevant cluster, and **Remediate**.
106
+
107
+
:::image type="content" source="./media/defender-for-kubernetes-usage/recommendation-to-install-policy-add-on-for-kubernetes-details.png" alt-text="Recommendation details page for Azure Policy add-on for Kubernetes should be installed and enabled on your clusters.":::
108
+
109
+
## View and configure the bundle of recommendations
67
110
68
111
1. Approximately 30 minutes after the add-on installation completes, Defender for Cloud shows the clusters’ health status for the following recommendations, each in the relevant security control as shown:
69
112
@@ -95,47 +138,55 @@ To configure the recommendations, install the **Azure Policy add-on for Kuberne
95
138
| Running containers as root user should be avoided | Manage access and permissions | No |
96
139
||||
97
140
141
+
For recommendations with parameters that need to be customized, you will need to set the parameters:
142
+
143
+
**To set the parameters**:
144
+
145
+
1. Sign in to the [Azure portal](https://portal.azure.com).
146
+
147
+
1. Navigate to **Microsoft Defender for Cloud** > **Environment settings**.
98
148
99
-
1.For the recommendations with parameters that need to be customized, set the parameters:
149
+
1.Select the relevant subscription.
100
150
101
-
1. From Defender for Cloud's menu, select **Security policy**.
102
-
1. Select the relevant subscription.
103
-
1.From the **Defender for Cloud default policy** section, select **View effective policy**.
104
-
1. Select the default policy for the scope you're updating.
105
-
1. Open the **Parameters** tab and modify the values as required.
151
+
1. From Defender for Cloud's menu, select **Security policy**.
152
+
153
+
1.Select the relevant assignment. The default assignment is `ASC default`.
154
+
155
+
1. Open the **Parameters** tab and modify the values as required.
106
156
107
-
:::image type="content" source="media/kubernetes-workload-protections/containers-parameter-requires-configuration.png" alt-text="Modifying the parameters for one of the recommendations in the Kubernetes workload protection bundle.":::
157
+
:::image type="content" source="media/kubernetes-workload-protections/containers-parameter-requires-configuration.png" alt-text="Modifying the parameters for one of the recommendations in the Kubernetes workload protection bundle.":::
108
158
109
-
1. Select **Review + save**.
110
-
1. Select **Save**.
159
+
1. Select **Review + save**.
160
+
161
+
1. Select **Save**.
111
162
163
+
**To enforce any of the recommendations**:
112
164
113
-
1.To enforce any of the recommendations,
165
+
1.Open the recommendation details page and select **Deny**:
114
166
115
-
1. Open the recommendation details page and select **Deny**:
167
+
:::image type="content" source="./media/defender-for-kubernetes-usage/enforce-workload-protection-example.png" alt-text="Deny option for Azure Policy parameter.":::
116
168
117
-
:::image type="content" source="./media/defender-for-kubernetes-usage/enforce-workload-protection-example.png" alt-text="Deny option for Azure Policy parameter.":::
169
+
This will open the pane where you set the scope.
118
170
119
-
This will open the pane where you set the scope.
171
+
1. When you've set the scope, select **Change to deny**.
120
172
121
-
1. When you've set the scope, select **Change to deny**.
173
+
**To see which recommendations apply to your clusters**:
122
174
123
-
1.To see which recommendations apply to your clusters:
175
+
1.Open Defender for Cloud's [asset inventory](asset-inventory.md) page and use the resource type filter to **Kubernetes services**.
124
176
125
-
1.Open Defender for Cloud's [asset inventory](asset-inventory.md) page and use the resource type filter to **Kubernetes services**.
177
+
1.Select a cluster to investigate and review the available recommendations available for it.
126
178
127
-
1. Select a cluster to investigate and review the available recommendations available for it.
179
+
When viewing a recommendation from the workload protection set, you'll see the number of affected pods ("Kubernetes components") listed alongside the cluster. For a list of the specific pods, select the cluster and then select **Take action**.
128
180
129
-
1. When viewing a recommendation from the workload protection set, you'll see the number of affectedpods ("Kubernetes components") listed alongside the cluster. For a list of the specific pods, select the cluster and then select **Take action**.
181
+
:::image type="content" source="./media/defender-for-kubernetes-usage/view-affected-pods-for-recommendation.gif" alt-text="Viewing the affected pods for a K8s recommendation.":::
130
182
131
-
:::image type="content" source="./media/defender-for-kubernetes-usage/view-affected-pods-for-recommendation.gif" alt-text="Viewing the affected pods for a K8s recommendation.":::
183
+
**To test the enforcement, use the two Kubernetes deployments below**:
132
184
133
-
1. To test the enforcement, use the two Kubernetes deployments below:
185
+
- One is for a healthy deployment, compliant with the bundle of workload protection recommendations.
134
186
135
-
- One is for a healthy deployment, compliant with the bundle of workload protection recommendations.
136
-
- The other is for an unhealthy deployment, non-compliant with *any* of the recommendations.
187
+
- The other is for an unhealthy deployment, non-compliant with *any* of the recommendations.
137
188
138
-
Deploy the example .yaml files as-is, or use them as a reference to remediate your own workload (step VIII)
189
+
Deploy the example .yaml files as-is, or use them as a reference to remediate your own workload (step VIII).
0 commit comments