审核 AWS 上的 k8s 集群事件

Audit k8s cluster events on AWS

对于 EKS 集群,cloudtrail 记录集群事件,例如创建、更新和删除。但是我们使用 kubeadm 来提供集群。我们如何记录这些集群事件的审计线索?谢谢。

CloudTrail 在 AWS 中记录 API 事件,因此我认为您不能将它用于 K8S 事件。但是,您可以使用日志传送器将自定义指标发送到 CloudWatch。从那里您可以发出事件并创建仪表板。

为此,您有几个选择,您可以使用 CloudWatch 代理、Elastic Beat、Logstash,或者如果您不想使用 CloudWatch,也可以使用 Splunk 之类的东西。

从 K8S 文档中,有一个审核日志(对于您的集群可能位于 /var/log/kube-audit),它...

Kubernetes auditing provides a security-relevant chronological set of records documenting the sequence of activities that have affected system by individual users, administrators or other components of the system. It allows cluster administrator to answer the following questions:

您可以 ship/parse 使用其他服务记录此日志。

如果您需要更好地控制结果,您可以根据 libbeat 规范编写自定义 Beat。 https://github.com/elastic/beats/tree/master/libbeat

不然我觉得用Filebeat的人很多:https://github.com/elastic/beats/tree/master/deploy/kubernetes

K8S 还支持自定义审计策略以进一步控制