How do you make sure audit logs from the Kubernetes API server are captured and useful?
IntermediateScenarioLogging Pipelines
Answer
Situation read → API audit logs answer "who did what to which resource", but default levels can be huge.
What I'd do →
- Write an audit policy:
Metadatafor most resources,RequestResponsefor RBAC and secrets changes,Nonefor noisy reads likegeton events and leases. - On self-managed clusters set
--audit-policy-fileand--audit-log-pathor a webhook backend. On EKS enable theauditcontrol plane log type to CloudWatch. - Ship to the SIEM and alert on sensitive actions:
create clusterrolebinding,execinto pods, secret reads by humans.
Why → Audit logs are your forensic record for cluster access.
Interview tip → Never log secret contents; use Metadata level for secrets.
More on Logging Pipelines
Developers SSH into servers and `grep` log files to debug. You are asked to centralise logging. Where do you start?BeginnerYour app writes free-text logs like `User 42 paid 19.99 in 340ms`. Why push for structured logging, and how?BeginnerLoki ingestion is failing with `stream limit exceeded` and the ingester memory is exploding. What happened?IntermediateFluent Bit pods on busy nodes are dropping logs during traffic spikes. How do you make the pipeline lossless?IntermediateThe Elasticsearch cluster for logs goes red every Monday after the weekend batch jobs. How do you stabilise it?AdvancedFinance says the log bill doubled in a quarter. How do you cut it without losing debugging ability?Intermediate