Auditing and logging
Google Cloud comes with logging and auditing out-of-the-box. Once we provision a Kubernetes cluster, all the operations will be visible through the logging console.
Suppose we create a secret on the cluster we provisioned previously:
$ kubectl create secret generic empty-secret
This action will be logged on the audit logs of GKE, and all we must do is search the logging console on GCP using the following query:
protoPayload.methodName="io.k8s.core.v1.secrets.create" protoPayload.@type="type.googleapis.com/google.cloud.audit.AuditLog" resource.type="k8s_cluster"
As a result, we should see all the operations upon accessing Secrets:
Figure 10.1 – Kubernetes audit logs on GKE
Apart from audit logs on Kubernetes, we can also utilize the audit logs on Secret Manager. On the logging screen of GCP, we can search specifically for audit logs:
resource.type="audited_resource" AND...