在 Google Kubernetes Engine 中设置 kubernetes 审计策略

Setting kubernetes audit policies within Google Kubernetes Engine

我已经在 GKE 中创建了一个 k8s 集群。但是我想为 k8s 审计目的配置 API 服务器,所以我必须将 --audit-policy-file 标志和 --audit-webhook-config-file 标志设置为 API 服务器中的参数。我该怎么做?

恐怕不可能。

请记住,On-Premise Kubernetes 集群和 GKE 集群之间存在一些差异。最重要的是 GKE master 完全由 Google 管理,您无法访问它或在那里更改任何内容。例如,在 Vulnerability and patch management 文档中,您可以找到信息:

GKE control plane components are managed by a team of Google site reliability engineers, and are kept up to date with the latest security patches. This includes patches to the host operating system, Kubernetes components, and containers running on the control plane VMs.

简而言之,您无法为 GKE 更改 Audit Policy,但是在 GKE Audit Policy 中您可以了解其工作原理。

Audit Logs are pre configured by Google and the only thing you can do is filtering. There is also a Data Access Log 默认情况下禁用。您可以启用它以获取更多信息,但需要额外付费。

我最后想提的是,已经有一个 Feature Request 要求覆盖 audit-policy-file。您可以在报告中找到更多详细信息 - Adjusting audit log levels