Every action is a request to the API server Whether you click a dashboard button or type a command, every Kubernetes action is a request to the API server.
So recording at the API server alone captures who did what, without gaps. But recording starts only when you provide an audit policy.
Each request leaves one entry: who, when, what An audit entry holds the requester (a person or ServiceAccount), the time, the target resource and namespace, the verb (get, create, delete, etc.) and the result code.
Requests that failed authentication or were denied for lack of permission are recorded too. What someone tried and was blocked from is also part of the audit.
What changed in this step
+ who: user A+ when: request time+ on what: secrets/db-pass+ verb: get+ result: 200The audit policy decides what to record and at what level There are four levels. None records nothing. Metadata records who, when, on what, which verb and the result. Request adds the request body. RequestResponse adds the response body too.
A policy is a list of rules, matched from the top, and the first matching rule's level applies. So rule order changes the outcome.
Key idea Recording more is not better. An audit policy is a design decision about what to record and at what level.
What changed in this step
+ Secrets: Metadata+ other changes: Request+ frequent, low-value requests: NoneDeveloper A reads a Secret Developer A reads the db-pass Secret with get. A has permission, so the request succeeds.
The policy's first rule says to log Secrets at Metadata, so only who read which Secret and when is recorded. The secret value is not.
Logging Secrets at RequestResponse leaves secrets in the log If Secret requests are logged at RequestResponse, the response body, that is, the secret value, is written to the audit log as is.
The audit log itself then becomes a new leak path. Storage use also jumps.
Watch out Audit logs are data that can hold secrets too. Log Secrets at Metadata, and control access to the logs separately.
Security finds out "who read it" With the policy back at Metadata, the security team searches for get records on db-pass. The requester and time show up at once.
Next they check whether that read permission was really needed, and whether there were other odd requests at that time. Even a read-only role needs this kind of tracing if it includes reading Secrets.
Ship logs to storage outside the cluster The API server can write audit records to a file on the control plane node, or send them to an external collector via webhook.
If they stay only in a file on the node, they vanish when the node is lost or an attacker deletes them. So move them to log storage and search there.
Set retention and export procedures to make logs usable for audits Decide how long to keep records, and who hands them over by what procedure when an audit request comes. Only then are they usable in a real audit.
Set retention to match security rules or audit requirements. API server log files rotate with --audit-log-maxage and --audit-log-maxbackup, so move records you need to keep longer to separate storage.
What, at what level, where, and for how long The API server recorded each request according to the audit policy and shipped the records to storage, where we later found who did what.
Sensitive resources like Secrets must be logged only at Metadata, so the audit log does not become a leak path.
Summary Audit logs record who did what and how. Always record permission changes, Secret reads and deletions, and log sensitive resources at Metadata so the log does not become a leak.