Security wants to know who deleted a production deployment last Friday. Audit logging was never configured. What do you set up?
IntermediateScenarioKubernetes Security
Answer
Situation read → Without audit logs, that question has no answer. Turn them on now and keep them off-cluster.
What I'd do →
- Managed clusters: enable control plane audit logs (
aws eks update-cluster-config --logging '{"clusterLogging":[{"types":["audit"],"enabled":true}]}', GKE has Admin Activity on by default). - Self-managed: write an audit policy logging
RequestResponsefor secrets metadata only,Metadatafor most, and drop noisy reads. - Ship to a SIEM with retention matching compliance (often 1 year).
- Alert on high-risk verbs:
deleteon deployments in prod,createon clusterrolebindings,pods/exec. - For Friday's event: check GitOps history and CI logs, which may still show who changed what.
Why → Audit logs are the only record of who did what in the cluster.
Interview tip → Never log secret values at RequestResponse level; use Metadata for secrets.
More on Kubernetes Security
What are the 4Cs of cloud native security?BeginnerWhat happens to a request between `kubectl apply` and etcd from a security point of view?IntermediateExplain Role, ClusterRole, RoleBinding and ClusterRoleBinding.BeginnerHow do you check what a user or service account is allowed to do?BeginnerWhich RBAC permissions are effectively cluster-admin in disguise?AdvancedHow do service account tokens work now, and what is `automountServiceAccountToken`?Intermediate