你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
使用 Defender for Containers 保护 Google Cloud Platform (GCP) 容器
Microsoft Defender for Cloud 中的 Defender for Containers 是一款用于保护容器的云原生解决方案,可用于改进、监视和维护群集、容器及其应用程序的安全性。
有关详细信息,请参阅 Microsoft Defender for Containers 概述。
你可以在定价页上了解有关 Defender for Containers 定价的更多信息。
先决条件
需要 Microsoft Azure 订阅。 如果你没有 Azure 订阅,可以注册免费订阅。
必须在 Azure 订阅上启用 Microsoft Defender for Cloud。
只有在使用相关操作系统时,才能验证以下域。
域 端口 主机操作系统 amazonlinux.*.amazonaws.com/2/extras/* 443 Amazon Linux 2 yum 默认存储库 - RHEL/Centos apt 默认存储库 - Debian
在 GCP 项目上启用 Defender for Containers 计划
保护 Google Kubernetes Engine (GKE) 群集:
登录 Azure 门户。
搜索并选择“Microsoft Defender for Cloud”。
在 Defender for Cloud 菜单中,选择“环境设置”。
选择相关的 GCP 项目。
选择“下一步: 选择计划”按钮。
确保容器计划已切换到“打开”。
选择“复制”按钮。
选择“GCP Cloud Shell”按钮。
将脚本粘贴到 Cloud Shell 终端并运行它。
脚本执行后,连接器将更新。 此过程可能需要长达 6 到 8 小时才能完成。
选择“下一步: 审阅并生成>”。
选择“更新”。
注意
若要启用或禁用单个 Defender for Containers 功能(全局或针对特定资源),请参阅如何启用 Microsoft Defender for Containers 组件。
将解决方案部署到特定群集
如果在 GCP 连接器加入过程中或之后,通过切换到“关闭”禁用了任何默认的自动预配配置, 需要手动将已启用 Azure Arc 的 Kubernetes、Defender 代理和适用于 Kubernetes 的 Azure Policy 安装到每个 GKE 群集,才能充分利用 Defender for Containers 的完整安全性。
对于这些扩展及 Arc(如有必要)的安装,Defender for Cloud 提供了两条有针对性的建议以供使用:
GKE clusters should have Microsoft Defender's extension for Azure Arc installed
GKE clusters should have the Azure Policy extension installed
注意
安装 Arc 扩展时,必须验证所提供的 GCP 项目是否与相关连接器中的项目相同。
将解决方案部署到特定群集:
登录 Azure 门户。
搜索并选择“Microsoft Defender for Cloud”。
在 Defender for Cloud 菜单中,选择“建议”。
在 Defender for Cloud 的“建议”页中,按名称搜索上述每一条建议。
选择不正常的 GKE 群集。
重要
必须逐一选择群集。
请勿按超链接名称选择群集:选择相关行中的任何其他位置。
选择不正常资源的名称。
选择“修复”。
Defender for Cloud 将使用所选语言生成脚本:
- 对于 Linux,请选择“Bash”。
- 对于 Windows,请选择“PowerShell”。
选择“下载修正逻辑”。
在群集上运行生成的脚本。
针对第二条建议重复步骤 3 到 10。
后续步骤
有关 Defender for Containers 的高级启用功能,请参阅启用 Microsoft Defender for Containers 页面。