Kubernetes Audit Policy
Contents
Audit Stages
| Stage | Description |
|---|---|
| RequestReceived | The stage for events generated as soon as the audit handler receives the request, and before it is delegated down the handler chain. |
| ResponseStarted | Once the response headers are sent, but before the response body is sent. This stage is only generated for long-running requests (e.g. watch). |
| ResponseComplete | The response body has been completed and no more bytes will be sent. |
| Panic | Events generated when a panic occurred. |
Audit Policy
| Policy | Description |
|---|---|
| None | don’t log events that match this rule. |
| Metadata | log request metadata (requesting user, timestamp, resource, verb, etc.) but not request or response body. |
| Request | log event metadata and request body but not response body. This does not apply for non-resource requests. |
| RequestResponse | log event metadata, request and response bodies. This does not apply for non-resource requests. |
Config Audit
Audit
Log file in --audit-log-path
Policy file in --audit-policy-file
Log max age in --audit-log-maxage
You have to make volumes and volumeMounts in kube-apiserver.yaml
/etc/kubernetes/manifests/kube-apiserver.yaml
| |
kube-apiserver.service
| |
Audit Policy Sample
| |
CozyFex