|
| 1 | +--- |
| 2 | +title: Benefits of Azure Defender for Arc enabled Kubernetes |
| 3 | +description: Learn how to secure your Arc enabled Kubernetes clusters with Azure Defender for Kubernetes |
| 4 | +services: security-center |
| 5 | +author: memildin |
| 6 | +manager: rkarlin |
| 7 | +ms.service: security-center |
| 8 | +ms.topic: how-to |
| 9 | +ms.date: 01/19/2021 |
| 10 | +ms.author: memildin |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +# Azure Defender for Arc enabled Kubernetes |
| 15 | + |
| 16 | +## Availability |
| 17 | + |
| 18 | +|Aspect|Details| |
| 19 | +|----|:----| |
| 20 | +|Release state:|**Preview**| |
| 21 | +|Required roles and permissions:|**Security admin** can dismiss alerts<br>**Security reader** can view findings| |
| 22 | +|Supported Kubernetes distributions:|[Kubernetes](https://kubernetes.io/docs/home/)<br>[AKS Engine](https://github.com/Azure/aks-engine)<br>[OpenShift (version 4 and higher)](https://github.com/openshift/kubernetes)| |
| 23 | +||| |
| 24 | + |
| 25 | +## Description |
| 26 | + |
| 27 | +Azure Defender for Kubernetes is expanding its support from Azure Kubernetes Service to *any* Kubernetes cluster, leveraging Azure Arc for Kubernetes. |
| 28 | + |
| 29 | +This preview brings the management layer threat detection capabilities that Azure Security Center offers today (through Azure Defender for Kubernetes) to Arc connected Kubernetes clusters. |
| 30 | + |
| 31 | + |
| 32 | +- [Azure Security Center enabled on your designated subscription](https://docs.microsoft.com/azure/security-center/security-center-get-started#enable-security-center-on-your-azure-subscription). |
| 33 | + |
| 34 | + |
| 35 | +## Architecture overview |
| 36 | + |
| 37 | +Azure Defender for Kubernetes' ability to monitor and provide threat protection capabilities relies on an Azure Arc extension. The extension collects Kubernetes audit logs data from all control plane (master) nodes in the cluster and sends them to the Azure Defender for Kubernetes backend in the cloud for further analysis. The extension is registered with a Log Analytics workspace that's used as a data pipeline. The audit log data isn't stored in the Log Analytics workspace. |
| 38 | + |
| 39 | +This is a high-level diagram outlining the interaction between Azure Defender for Kubernetes and the Azure Arc-enabled Kubernetes cluster: |
| 40 | + |
| 41 | +:::image type="content" source="media/defender-for-kubernetes-azure-arc/defender-for-kubernetes-architecture-overview.png" alt-text="A high-level architecture diagram outlining the interaction between Azure Defender for Kubernetes and an Azure Arc enabled Kubernetes clusters."::: |
| 42 | + |
| 43 | +## Get started |
| 44 | + |
| 45 | +> [!IMPORTANT] |
| 46 | +> The instructions in this section use Azure CLI and should be run from a Linux machine (or [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/windows/wsl/install-win10)) that has the kubeconfig of your Arc connected cluster. |
| 47 | +
|
| 48 | +### Step 1 - Prepare the environment |
| 49 | + |
| 50 | +1. Using the following command, verify that you have version 2.12.0 (or newer) of Azure CLI: |
| 51 | + |
| 52 | + ``az -v`` |
| 53 | + |
| 54 | + If you don't have Azure CLI, or need to upgrade, see [Install Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli). |
| 55 | + |
| 56 | +1. As mentioned in the prerequisites, you'll need a Kubernetes cluster. If you need to set one up, do so at this stage. |
| 57 | + |
| 58 | +1. To verify that your control plane (master) nodes are labelled "node-role.kubernetes.io/master" (this is the Kubernetes default), run the following command on your control plane (master) nodes: |
| 59 | + |
| 60 | + ``kubectl get nodes --show-labels`` |
| 61 | + |
| 62 | + > [!NOTE] |
| 63 | + > To label your control plane (master) node, run the following command: |
| 64 | + > |
| 65 | + > ``kubectl label node <NODE-NAME> node-role.kubernetes.io/master`` |
| 66 | +
|
| 67 | +1. Optionally, if you're using a proxy or firewall verify that port 443 is enabled for outbound communication. This is required for the Azure Arc extension to communicate with the Azure Defender service backend. |
| 68 | + |
| 69 | +1. To establish the required configuration and settings for the Azure Arc extension, run the following commands: |
| 70 | + |
| 71 | + ``az login`` |
| 72 | + |
| 73 | + ``az account set --subscription <subscription-id>`` |
| 74 | + |
| 75 | + ``wget -O- https://azuredefenderforarc.blob.core.windows.net/azuredefenderforarc/InstallAzureDefenderExtension.Prerequisites.sh | bash`` |
| 76 | + |
| 77 | +1. If your cluster is already connected to Arc (public preview version), [disconnect it](https://docs.microsoft.com/azure/azure-arc/kubernetes/connect-cluster#delete-a-connected-cluster) before continuing. |
| 78 | + |
| 79 | + > [!TIP] |
| 80 | + > This Azure Defender preview requires a private preview version of Azure Arc to support extension installation. Therefore, the cluster must be connected with the version established by the script downloaded in the previous instruction. |
| 81 | +
|
| 82 | +1. Connect your Kubernetes cluster to Arc as described in [Connect an Azure Arc-enabled Kubernetes cluster](https://docs.microsoft.com/azure/azure-arc/kubernetes/connect-cluster#before-you-begin). |
| 83 | + |
| 84 | + |
| 85 | +### Step 2 - Default installation of the Arc extension for Azure Defender |
| 86 | + |
| 87 | +For the default deployment of this extension to your Kubernetes cluster, follow the instructions in this section. |
| 88 | + |
| 89 | +If you want to change any defaults, for example to configure a proxy endpoint or a dedicated Log Analytics workspace, use the [Advanced installation](#advanced-installation) procedure. |
| 90 | + |
| 91 | +1. To deploy the extension: |
| 92 | + |
| 93 | + - For a Kubernetes or AKS-Engine cluster, run the following command: ``az k8s-extension create --cluster-type connectedClusters --cluster-name <your-cluster-name> --resource-group <your-rg> --extension-type microsoft.azuredefender.kubernetes --name microsoft.azuredefender.kubernetes`` |
| 94 | + |
| 95 | + - For an OpenShift cluster, run the following command: ``az k8s-extension create --cluster-type connectedClusters --cluster-name <your-cluster-name> --resource-group <your-rg> --extension-type microsoft.azuredefender.kubernetes --name microsoft.azuredefender.kubernetes --configuration-settings Azure.Cluster.kubernetesDistro="openshift"`` |
| 96 | + |
| 97 | + Where: |
| 98 | + |
| 99 | + - **your-cluster-name** - Your Arc connected cluster name |
| 100 | + - **your-rg** - Your Arc connected cluster resource group |
| 101 | + |
| 102 | + If you want to specify advanced options like a proxy endpoint or details of your own Log Analytics workspace, see [Advanced installation](#advanced-installation). |
| 103 | + |
| 104 | + > [!IMPORTANT] |
| 105 | + > The process may take a few minutes to complete, so we recommend waiting before moving on to installation verification. |
| 106 | +
|
| 107 | +1. To verify that the installation was successful: |
| 108 | + |
| 109 | + 1. Run the following command and under "extensionType": "microsoft.azuredefender.kubernetes", look for "installState": "Installed" (it might show "installState": "pending" for the first few minutes): |
| 110 | + |
| 111 | + ``az k8s-extension show --cluster-type connectedClusters --cluster-name <your-cluster-name> --resource-group <your-rg> --name microsoft.azuredefender.kubernetes`` |
| 112 | + |
| 113 | + 1. Run the following command and check that a pod called "azuredefender-XXXXX" is running: |
| 114 | + |
| 115 | + ``kubectl get pods -n azuredefender`` |
| 116 | + |
| 117 | +### Advanced installation |
| 118 | + |
| 119 | +For a simple installation using the default options, follow the instructions in [Step 2 - Default installation of the Arc extension for Azure Defender](#step-2---default-installation-of-the-arc-extension-for-azure-defender). To configure advanced options like a proxy endpoint or details of your own Log Analytics workspace, use the instructions below. |
| 120 | + |
| 121 | +1. To provide runtime threat protection capabilities, the extension collects [Kubernetes audit logs](https://kubernetes.io/docs/tasks/debug-application-cluster/audit/) from your cluster. To validate you Kubernetes audit logs are configured correctly: |
| 122 | + |
| 123 | + - If you haven't enabled audit logs, they'll automatically be enabled during the installation of the Azure Arc extension. When audit logs are automatically enabled in your cluster, a backup of the kube-apiserver.yaml file is generated to provide you with a rollback option. The backup will be saved at ``/var/log/kube-apiserver.yaml.backup``. |
| 124 | + |
| 125 | + - If you've already enabled audit logs, use this policy file to verify that you're collecting the necessary events for the Arc extension for Azure Defender for Kubernetes: [audit_policy.yaml](https://github.com/Azure/Azure-Security-Center/blob/master/Pricing%20%26%20Settings/Defender%20for%20Kubernetes/audit-policy.yaml). |
| 126 | + |
| 127 | + - When audit logs are already enabled on your cluster, your cluster's audit configuration and settings won't be modified during the installation of the extension. |
| 128 | + |
| 129 | + > [!NOTE] |
| 130 | + > In OpenShift and AKS Engine based clusters, audit logs are enabled by default. For both of these systems the audit configuration and settings won't be modified. |
| 131 | +
|
| 132 | +1. Optionally, configure a dedicated Log Analytics workspace: |
| 133 | + |
| 134 | + Log Analytics workspaces provide a robust and secure data pipeline. Security data collected from your cluster is sent by the extension to the Azure defender for Kubernetes service in Azure for analysis. The transfer utilizes a Log analytics workspace. |
| 135 | + |
| 136 | + > [!IMPORTANT] |
| 137 | + > The data collected will **not** be stored in this workspace **nor will you be charged for it**. |
| 138 | +
|
| 139 | + - To use your own workspace, enter the full Azure resource ID during the installation of the Azure Defender for Kubernetes Azure Arc extension. To get the full resource ID, run the following command to display the list of workspaces in your subscriptions in the default JSON format: |
| 140 | + |
| 141 | + ``az resource list --resource-type Microsoft.OperationalInsights/workspaces -o json`` |
| 142 | + |
| 143 | + In the output, find the designated workspace name, and then copy the full resource ID of that Log Analytics workspace. Keep it available for use when running the ``create`` command below. |
| 144 | + |
| 145 | + - You can create a new workspace using [Azure Resource Manager](https://docs.microsoft.com/azure/azure-monitor/samples/resource-manager-workspace), [PowerShell](https://docs.microsoft.com/azure/azure-monitor/scripts/powershell-sample-create-workspace?toc=/powershell/module/toc.json), or the [Azure portal](https://docs.microsoft.com/azure/azure-monitor/learn/quick-create-workspace). |
| 146 | + |
| 147 | + - If you don't supply details of your own workspace, the Arc extension will connect to the default Log Analytics workspace of your resource group’s region. If one doesn’t exist in the region, it will be created (at no additional cost). |
| 148 | + |
| 149 | +1. Optionally, configure a proxy endpoint: |
| 150 | + |
| 151 | + You can configure the extension to communicate through your outbound HTTP/HTTPS proxy server. Both anonymous and basic authentication (username/password) are supported. At this time, certificate based auth proxy servers are not supported. |
| 152 | + |
| 153 | + The proxy configuration uses the syntax ``protocol://user:password@proxyhost:port`` and is entered in the ``create`` command in the next instruction below. |
| 154 | + |
| 155 | + > [!IMPORTANT] |
| 156 | + > If your proxy server does not require authentication, you still need to specify a pseudo username/password. This can be any username or password. |
| 157 | +
|
| 158 | + |Property|Description| |
| 159 | + |----|:----| |
| 160 | + | Protocol | http or https | |
| 161 | + | user | Optional username for proxy authentication | |
| 162 | + | password | Optional password for proxy authentication | |
| 163 | + | proxyhost | Address or FQDN of the proxy server | |
| 164 | + | port | Optional port number for the proxy server | |
| 165 | + ||| |
| 166 | + |
| 167 | + For example: ``http://user01:[email protected]:3128`` |
| 168 | + |
| 169 | + If you specify the protocol as **http**, the HTTP requests are created using SSL/TLS secure connection. Your proxy server must support SSL/TLS protocols. |
| 170 | + |
| 171 | +1. To deploy the Azure Arc extension (consult the table for details of the properties): |
| 172 | + |
| 173 | + ``az k8s-extension create --cluster-type connectedClusters --cluster-name <your-cluster-name> --resource-group <your-rg> --extension-type microsoft.azuredefender.kubernetes --name microsoft.azuredefender.kubernetes --configuration-settings logAnalyticsWorkspaceResourceID=<log-analytics-workspace-resource-id> auditLogPath=<your-auditlog-path> Azure.Cluster.kubernetesDistro=<your-kubernetes-distribution> --configuration-protected-settings proxyEndpoint=<your-proxy-endpoint>`` |
| 174 | + |
| 175 | + |Property|Description| |
| 176 | + |----|:----| |
| 177 | + |cluster-name|Your Arc connected cluster name.| |
| 178 | + |resource-group|Your Arc connected cluster resource group.| |
| 179 | + |logAnalyticsWorkspaceResourceID|**Optional**. Full resource ID of your own Log Analytics workspace. When not provided, the default workspace of the region will be used.| |
| 180 | + |proxyEndpoint|**Optional**. The proxy endpoint configuration value with the following syntax:<br>protocol://user:password@proxyhost:port as described in the previous instruction.<br><br>**proxyEndpoint** is only allowed in **--configuration-protected-settings** since it can have credentials in it. Unlike configuration settings, configuration protected settings are NOT returned in GET and LIST responses, and thus not exposed after they are set during the creation of extension.| |
| 181 | + |auditLogPath|**Optional**. The full path to the audit log files. The default value is ``/var/log/kube-apiserver/audit`` as the auto enablement of audit logs configures this path.| |
| 182 | + |Azure.Cluster.kubernetesDistro|**Optional**. If your Arc connected cluster is OpenShift, specify "OpenShift". Otherwise, this property is ignored.| |
| 183 | + ||| |
| 184 | + |
| 185 | + > [!IMPORTANT] |
| 186 | + > The process may take a few minutes to complete, so we recommend waiting before moving on to installation verification. |
| 187 | +
|
| 188 | +1. To verify that the installation was successful: |
| 189 | + |
| 190 | + 1. Run the following command and under "extensionType": "microsoft.azuredefender.kubernetes", look for "installState": "Installed" (it might show "installState": "pending" for the first few minutes): |
| 191 | + |
| 192 | + ``az k8s-extension show --cluster-type connectedClusters --cluster-name <your-cluster-name> --resource-group <your-rg> --name microsoft.azuredefender.kubernetes`` |
| 193 | + |
| 194 | + 1. Run the following command and check that a pod called "azuredefender-XXXXX" is running: |
| 195 | + |
| 196 | + ``kubectl get pods -n azuredefender`` |
| 197 | + |
| 198 | +## Simulate security alerts from Azure Defender for Kubernetes |
| 199 | + |
| 200 | +A full list of supported alerts is available in the [Reference table for all security alerts in Azure Security Center](https://docs.microsoft.com/azure/security-center/alerts-reference#alerts-akscluster). You can simulate security alerts using the instructions below. |
| 201 | + |
| 202 | +1. To simulate an Azure Defender alert, run the following command: |
| 203 | + |
| 204 | + ``kubectl get pods --namespace=asc-alerttest-662jfi039n`` |
| 205 | + |
| 206 | + The expected response is "No resource found". |
| 207 | + |
| 208 | + Within 30 minutes, Azure Defender will detect this activity and trigger a security alert. |
| 209 | + |
| 210 | +1. To optionally simulate malicious-like deployment, run the following command: |
| 211 | + |
| 212 | + ``kubectl create -f https://azuredefenderforarc.blob.core.windows.net/azuredefenderforarc/AzureDefender-Trigger-K8S-Alerts.yaml`` |
| 213 | + |
| 214 | + Within 30 minutes, Azure Defender will detect this activity and trigger a security alert. |
| 215 | + |
| 216 | + > [!TIP] |
| 217 | + > To delete this deployment after your tests, run the following command: |
| 218 | + > |
| 219 | + > ``kubectl delete -f https://azuredefenderforarc.blob.core.windows.net/azuredefenderforarc/AzureDefender-Trigger-K8S-Alerts.yaml`` |
| 220 | +
|
| 221 | +1. In the Azure portal, open Azure Security Center's security alerts page: |
| 222 | + |
| 223 | + :::image type="content" source="media/defender-for-kubernetes-azure-arc/sample-kubernetes-security-alert.png" alt-text="Sample alert from Azure Defender for Kubernetes."::: |
| 224 | + |
| 225 | + > [!TIP] |
| 226 | + > This screenshot shows the recently released security alerts experience. Try it out! |
| 227 | +
|
| 228 | +## Uninstall the Arc extension |
| 229 | + |
| 230 | +1. To remove the Azure Defender for Kubernetes Arc extension with Azure CLI, run the following commands on your Arc enabled Kubernetes cluster: |
| 231 | + |
| 232 | + ``az login`` |
| 233 | + |
| 234 | + ``az account set --subscription <subscription-id>`` |
| 235 | + |
| 236 | + ``az k8s-extension delete --cluster-type connectedClusters --cluster-name <your-cluster-name> --resource-group <your-rg> --name microsoft.azuredefender.kubernetes --yes`` |
| 237 | + |
| 238 | + > [!IMPORTANT] |
| 239 | + > The uninstallation process might take a few minutes to complete. We recommend you wait before you try to verify that it was successful. |
| 240 | +
|
| 241 | +1. To verify that the extension was successfully removed, run the following commands: |
| 242 | + |
| 243 | + ``az k8s-extension show --cluster-type connectedClusters --cluster-name <your-cluster-name> --resource-group <your-rg> --name microsoft.azuredefender.kubernetes`` |
| 244 | + |
| 245 | + Verify the extension does not exist - there should be no delay. |
| 246 | + |
| 247 | + ``kubectl get pods -n azuredefender`` |
| 248 | + |
| 249 | + Validate that there are no pods called "azuredefender-XXXXX". It might take a few minutes for the pods to be deleted. |
| 250 | + |
| 251 | +## Feedback |
| 252 | + |
| 253 | +Please share your feedback, specifically in the areas below. You can submit your feedback via this [form](https://forms.office.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR29qPXYA7fJFpXjPCSwLwsNUQjA1R0FaTFBUMzRNODJBRUVGN1hQTkZGWS4u) or directly to the key contacts below. |
| 254 | + |
| 255 | +### Participant Information |
| 256 | + |
| 257 | +1. Please supply your name |
| 258 | +1. Organization |
| 259 | +1. Email address (If you are open to being contacted about your feedback) |
| 260 | +1. Your role within the organization |
| 261 | + |
| 262 | +### Feature feedback questions |
| 263 | + |
| 264 | +1. On which Kubernetes distribution did you test this private preview (e.g. OpenShift, AKS-Engine, Kubernetes)? Are there other Kubernetes distributions your organization might be interested in protecting with Azure Defender for Kubernetes? |
| 265 | +1. Is your Arc enabled Kubernetes behind a proxy service? If yes, which authentication method does the proxy service use (none, basic authentication, or certificate)? |
| 266 | +1. How important is an Azure native security offering for the Arc enabled Kubernetes solution? |
| 267 | +1. Which hybrid-cloud container security solution are you currently using for threat prevention, detection, and response? |
| 268 | +1. Did you have audit log enabled on your Arc enabled Kubernetes cluster before this preview? |
| 269 | +1. Were the steps and instruction of this preview clear and easy to understand? Did you run into any issues or errors during the preview? |
| 270 | +1. Did you get additional alerts during the preview time? Were they helpful/accurate? Would you like to see any adjustments to these alerts? |
| 271 | +1. What would you like to see in future release of "Azure Defender for Arc enabled Kubernetes"? |
| 272 | +1. Any other feedback you would like to give? |
| 273 | + |
| 274 | +## Key contacts |
| 275 | + |
| 276 | +Feature PM: Maya Herskovic [[email protected]](mailto:[email protected]) |
| 277 | + |
| 278 | +Private Preview PM: Gili Ben Zvi | [[email protected]](mailto:[email protected]) |
| 279 | + |
| 280 | +Thank you! Your participation is a vital part of our Cloud + AI Security product development process. |
| 281 | + |
| 282 | +Microsoft respects your privacy. Review our online [Privacy statement](https://privacy.microsoft.com/privacystatement). Microsoft Corporation, One Microsoft Way, Redmond, WA, USA 98052. |
| 283 | + |
| 284 | +At any point you may opt-out of the program by filling out [this form](https://aka.ms/OptOut_PrivatePreviewProgram). |
0 commit comments