Kubernetes audit logging

Kubernetes audit logging records who called the API, what they changed and what the server returned. This page explains how to design the audit policy, choose backends and retention, and send events to a SIEM.

On this page

Kubernetes audit logging: who did what in your cluster

Kubernetes audit logging records requests made to the API server, including who made each request, which object it touched and when it happened. In a self-managed cluster, your team must configure it, because the cluster does not give you a usable record of changes to workloads, roles or secrets until you do. When a security or compliance lead asks who changed a deployment, granted a role binding or read a Secret last quarter, the answer has to come from audit events you chose to keep and can still retrieve. Every request that reaches the API server is a candidate for recording, so deciding what the record covers is a design task to complete before the cluster takes production traffic.

Audit events are generated by the API server itself, so workloads running in the cluster do not write them. The user identity in each event comes from the authentication method you configured. Kubernetes has no API objects for normal users, so it relies on X.509 client certificates, bearer tokens including OpenID Connect and JWT tokens, webhook token authentication or an authenticating proxy to establish who is calling. The user name in an audit event is only as meaningful as that identity design. If engineers share a client certificate or a long-lived token, the log will show that credential rather than the person. Confirm with your identity team which method issues each kind of access before you rely on the record for attribution.

Nothing useful is recorded until you set two things: an audit policy that decides which requests are logged and at what level of detail, and a backend that receives the events and keeps them. Without a policy, the record is either absent or too thin to answer who did what. Without a backend, events have nowhere durable to go. The detail level also determines how much of each request body is captured, which matters for Secrets. These choices affect storage growth, what sensitive data ends up in logs and how quickly your SIEM can use the events. Your next step is to list the questions auditors and incident responders need answered, then map each one to a resource, a verb and a retention period you confirm with your compliance owner.

Audit policy levels, backends and retention options compared

This table compares the audit policy levels, the two audit backends and the log file retention options a Kubernetes team chooses between. Read each row for when it fits, its main cost and the item to confirm against the kube-apiserver version in use. The main takeaway is that broader levels and always-on backends increase event volume and sensitive content exposure, so teams usually set levels per resource and keep the broadest levels narrow.

OptionWhen it fitsMain costWhat to confirm
NoneExcludes matching requests from auditing, for example high-volume system traffic that the team has reviewed and accepts not logging.No evidence for excluded requests if an investigation later needs them.Which users, service accounts and resources the policy excludes, and who approved each exclusion.
MetadataRecords who acted, the resource, the verb and the timestamp without request or response bodies. A common starting point for broad coverage.Less detail on what changed, so some investigations need evidence from other sources.Whether your audit questions can be answered from metadata alone for each resource type.
RequestAdds the request body to metadata for resources where the change details matter, such as RBAC bindings.Larger events and more sensitive content, since request bodies can contain configuration values.Which resources can carry secrets or credentials in bodies and must be excluded or kept at Metadata.
RequestResponseAdds the response body as well. Suited to narrow, low-volume resources that must be reconstructed in full.Highest event volume and the most sensitive content, including Secret data returned in responses.How your policy handles Secrets and tokens at this level, and who can read the audit log.
Log file backendWrites events to a file on each control plane node, configured through an audit policy file and a log path on kube-apiserver.Local disk capacity, node-level collection and a shipper to move events to a SIEM.Log path, disk headroom and how your collector reads files on each control plane node.
Webhook backendSends events to an external receiver over a configured endpoint, suited to central collection without a node-level shipper.Receiver availability, delivery failure handling and TLS and credential setup for the endpoint.How the API server behaves when the receiver is unavailable and whether events can be lost or buffered.
Retention flags (log file)Control how long rotated log files are kept, how many are kept and the size at which a file rotates.Disk use on control plane nodes, which grows with the event volume set by your levels.Exact flag names and defaults in the kube-apiserver reference for your version, and your retention requirement.
Version dependenceLevel names, backend options and retention flags can change between Kubernetes releases.Review of the policy and flags at each minor version upgrade.Each item in the kubernetes.io audit documentation for the exact version you run.

How to write a Kubernetes audit policy resource by resource

Start the policy with the resources that answer access and privilege questions, because those are the events an investigation needs first. Put RBAC objects (Roles, ClusterRoles, RoleBindings and ClusterRoleBindings) at the top, followed by ServiceAccounts, authentication-related requests such as TokenReview and certificate signing requests, and workloads that can run privileged or reach host namespaces. For these resources, a Request level records who made the change and what they asked for, which is usually the detail a reviewer needs when a binding grants more access than expected. Before writing any rule, ask your security and compliance leads which privilege questions they must be able to answer from the logs, then map each question to a rule.

Broad read traffic is the main source of audit volume, so give it a lighter rule. Requests such as get, list and watch against common resources can produce large numbers of events from controllers and monitoring agents, and most of those events add little to an access investigation. A Metadata level records who made the request, when, against which resource and with which verb, without storing the body. Use it as a catch-all for reads once the privilege rules are in place. Confirm the expected volume on your own cluster before you commit, because the controllers and agents in your environment determine how many events you receive.

Secrets need the most care. Kubernetes stores Secrets unencrypted in etcd by default, and a request or response body for a Secret contains the credential itself. Write a rule that records Secrets at the Metadata level, so the log shows who read or changed a Secret without storing its value. Do not use Request or RequestResponse for Secrets unless a documented need exists and your log store is restricted to the same people who can read the Secrets. Encryption at rest and least-privilege RBAC for list and watch access reduce exposure in etcd and through the API, but they do not stop credentials from being copied into audit logs, so the audit policy has to handle that separately.

Rule order decides what happens to each event. The API server applies the first rule that matches an event, so a broad read rule placed above a Secrets rule will override the Secrets behavior you designed. Put the most specific rules first, end with a catch-all, and review the resource, verb and group fields each rule matches. Test the policy against the API server version you run, and check field names and behavior against the documentation for that version, because they can change between releases. Then generate test requests for each rule, such as reading a Secret, creating a RoleBinding and listing pods, and confirm that each one is recorded at the level you intended.

Enabling audit logging on kube-apiserver step by step

This sequence takes a self-managed control plane from no API audit logging to a tested configuration on every kube-apiserver. Each step ends with a check, so the team confirms the policy, the settings and the log output before moving on. The result is a documented, verified audit trail that security and compliance owners have reviewed.

  1. Inventory control plane nodes and authentication

    The platform team lists every control plane node, the etcd topology in use (stacked or external), how kube-apiserver is started on each node, and the authentication methods the cluster accepts, such as client certificates, OpenID Connect or webhook token authentication. They also record which load balancer fronts the API servers. The step is done when the inventory is signed off and the location of each node's API server configuration is confirmed. Check: compare the inventory against the control plane nodes the cluster reports and confirm you can open each node's API server configuration.

  2. Draft the audit policy and get approval

    The platform team drafts an audit policy that sets a level for each resource and user group. Sensitive resources, such as Secrets, are logged at the lowest level that still answers investigation questions. Security and compliance owners review the draft against their logging requirements and the controls they must evidence. Store the approved file in version control with reviewer names and dates. Check: the approved policy file is in the repository and every reviewer has recorded their approval.

  3. Copy the policy file to each node

    Copy the approved policy file to the same path on every control plane node, with ownership and permissions set so only administrators can change it. In kubeadm-managed clusters, this is done on each node directly, because the API server is defined by a static pod manifest on that node. Do not assume one node's copy will sync to the others. Check: compute a checksum of the file on every control plane node and confirm all values match.

  4. Edit the API server manifest on each node

    Set the kube-apiserver audit options for the policy file, the log path, retention and the log backend, using the names in the reference documentation for your target Kubernetes version. Mount the policy file and the log directory into the API server container so the process can read the policy and write the logs. In kubeadm clusters, make this edit in the kube-apiserver manifest on each control plane node and keep the settings identical across nodes. Check: diff each node's manifest against a reference copy and confirm that only node-specific values differ.

  5. Roll kube-apiserver one node at a time

    Restart or roll each kube-apiserver in turn, starting with a single control plane node. The kubelet recreates the static pod when its manifest changes, so the new settings take effect without a separate deployment step. Wait until the API server on that node is healthy and its control plane pods report ready before moving to the next node, so the load balancer always has a working endpoint. Check: confirm the running pod on the node includes the new audit settings and that the API health checks pass before continuing.

  6. Verify audit events with a test action

    Using a dedicated test account, create and then delete a ConfigMap in a non-production namespace. The load balancer can send each request to any API server, so search the audit log on every control plane node. Confirm that the create and delete events appear with the expected user, verb and level, and that the object reference matches the test ConfigMap. Check: record the event timestamps and the test account in the change record so the test can be repeated after upgrades.

  7. Confirm retention and log handling

    Check that the retention and rotation settings keep logs for the period your security policy requires. Confirm that the disk on each control plane node has room for the log volume the policy will produce, and that the log files are readable only by administrators. If log shipping to a SIEM is planned, confirm that the shipping agent can read the files without loosening their permissions. Ask the security owner to confirm the retention period in writing. Check: run a rotation test on each node and confirm old files are kept and pruned as configured.

Protecting audit logs and the sensitive data they can contain

Audit events are only as useful as the identity behind them and the protection around the files and pipelines that carry them. The cards below cover who can change the policy and read the logs, how events reach the SIEM, what request bodies may expose, and how volume and retention are managed on control plane nodes.

Restricting access to policy and log files

The audit policy file and the log files on each control plane node define what is recorded and who can see it. Limit write access to the policy to administrators who also manage kube-apiserver flags, and restrict read access to log files, because events can reveal resource names, namespaces, users and source addresses. Confirm file ownership and permissions on every control plane node, not only the first one you configured.

Trusting the identity in each event

An audit event records the user and groups the API server authenticated, so its value depends on the authentication method. Client certificates, bearer tokens including OpenID Connect, webhook token authentication and authenticating proxies each have different ways of being forged, delegated or misconfigured. Review which methods are enabled on kube-apiserver, remove unused ones, and confirm that the proxy or webhook is the only path that can set identity headers or validate tokens.

Protecting integrity and transport to the SIEM

Events leave the cluster through a log file collector or a webhook backend, and each hop can lose, delay or alter records. Use encrypted and authenticated connections to the SIEM, restrict which hosts may send events to it, and monitor for gaps in event sequences. Decide where the authoritative copy lives and who may delete it, so an attacker with node access cannot quietly remove their own activity.

Keeping secret values out of request bodies

At the RequestResponse level, audit events include full request and response bodies, which for Secret objects contain base64-encoded values. Set the policy so Secrets, ConfigMaps containing credentials and token requests are logged at Metadata level or omitted, and test the policy by creating a sample Secret and checking the stored event. Remember that the same data may already sit unencrypted in etcd, so encryption at rest and restricted list and watch access remain necessary.

Managing log volume and disk space

Verbose policies on busy clusters can fill the disk on control plane nodes, which also host etcd and the API server. Set a maximum log size, a maximum number of rotated files and a maximum age through the backend flags, and place the log directory on a volume monitored for free space. Ask whether the SIEM receives events fast enough that local retention can stay short, and size the volume from measured event rates in a test cluster.

Rotating and retaining logs by policy

Rotation and retention periods should come from the organization's own records policy, not from default flag values. Local rotation protects disk space, while the SIEM or archive holds the retained copy for the period the policy requires. Document who approves changes to retention, how deletion is recorded, and how rotated files are archived and checked before they are removed from the node.

Shipping Kubernetes audit events to a SIEM

The first decision is how audit events leave the control plane. With the log backend, the API server writes events to a file on each control plane node, and a collector agent on the same node reads that file and forwards it to the SIEM. This keeps the request path of the API server simple and lets the collector handle transport, compression and retries. The cost is that the file becomes a second buffer on control plane disk. If the collector stops or falls behind, log rotation can delete events before they are shipped, and a full disk on a control plane node can affect the API server itself. Confirm the rotation settings for your Kubernetes version, size the disk for a collector outage, and alert on gaps in event delivery, not only on whether the agent process is running.

The webhook backend sends batches of events from the API server to an external HTTP endpoint, usually a log receiver or a SIEM ingest service. No file or collector is needed on the nodes, and forwarding does not depend on local disk. The trade-off moves into the API server. Delivery behavior depends on the buffering and retry settings that the webhook configuration exposes, and the availability and latency of the endpoint become part of control plane behavior. If the endpoint stalls and buffers fill, you need to know in advance whether events are dropped, retried or allowed to slow requests. Confirm the failure modes for your version in the Kubernetes documentation, then test them in a non-production cluster by blocking the endpoint and measuring what happens to both the events and API latency.

Parsing effort matters more than the choice of transport suggests. Neither backend hands the SIEM a parsed Kubernetes model, so every pipeline needs field mapping from the audit event structure, including the user, verb, object reference, response status and source addresses, into the schema the SIEM expects. Do not assume any product ships a Kubernetes audit parser. Confirm what each candidate provides, then write tests for the events that carry the most risk, such as reads of Secrets and changes to RBAC bindings. Wazuh is distributed under the GNU General Public License version 2, with an exception that permits linking with the OpenSSL library, so have legal review that exception against your own obligations. Its indexer stores alerts, and the Wazuh documentation should be checked for the supported path to ingest Kubernetes audit events before you design around a particular collector or file location.

OpenSearch, Graylog and Grafana Loki are other common choices for storing and searching these events, and the right one depends on the tooling your team already runs. If you operate a search cluster, dashboards or label-based log storage today, the audit pipeline should feed the tools your analysts already use. Storage sizing follows event volume, which depends on the audit policy you write, so measure volume in a staging cluster before you commit to capacity. Ask each candidate how it handles a burst of events when ingestion slows, what happens to events it has already accepted, and how access controls apply to audit data. Set audit retention as a separate decision from the SIEM choice, because the required period is set by your compliance and investigation obligations.

What to confirm about audit logging in your cluster

These six items decide what audit configuration is possible and what it must produce. Confirm them before writing the policy, because the answers set the API version, the delivery path and the retention design. DeployOpen prepares the configuration and evidence, and independent auditors decide whether controls meet a framework.

API server version and audit policy

The kube-apiserver version running your control plane determines which audit features exist and which API version your audit policy file must use. Check the minor version against the Kubernetes releases page, including its end-of-life date, and confirm the policy API version your target release accepts. Test the policy file on that version in a staging cluster before every upgrade, because a policy that loads on one minor version may need changes on the next.

Distribution and conformance scope

The CNCF Certified Kubernetes conformance program checks that a distribution supports the required Kubernetes APIs. It does not verify every operational detail of audit configuration, such as where audit logs are written, how they rotate, or how webhook backends are wired. Ask your distribution vendor which audit flags, log paths and backend options it exposes and documents, and confirm them in a non-production cluster before you rely on them.

Managed control plane settings

Some managed control planes limit access to kube-apiserver flags, so you may not be able to supply a custom audit policy or choose the log backend. Ask the provider whether audit policy is configurable, which levels and resources it covers, where events are delivered, and whether you can export them to your SIEM. If a setting is not exposed, record what you cannot log and which compensating control covers that gap.

SIEM ingestion format and throughput

Your SIEM must accept the audit event format your pipeline delivers, and it must keep up with the event volume your policy generates. Confirm the supported ingestion format, any parser or decoder you need to build, and the sustained events per second the SIEM and its collector can handle. Load test with a policy that matches production verbosity, since broad policies on busy clusters can produce large volumes quickly.

Storage and retention requirements

Your organization sets retention periods, storage capacity, access rules and deletion controls for audit logs, based on internal policy and the regulations that apply to you. Confirm the retention period for each log store, who can read or delete events, how logs are backed up, and how they are protected from tampering. Size storage from the policy levels you choose and the request rate you measure, then document the decision so auditors can trace it.

CIS benchmark version applicability

The CIS Kubernetes Benchmark includes audit logging recommendations, but its guidance is tied to specific Kubernetes versions and to the platform it covers. Confirm which benchmark version matches your cluster, which audit recommendations apply to your distribution or managed service, and which do not. Record each decision with its reason, since the benchmark is a configuration guide and independent auditors decide whether controls meet a framework.

Keeping audit logging consistent across HA control planes and upgrades

The audit policy file and the kube-apiserver audit flags must be identical on every control plane node. The kubeadm high availability guide describes a stacked topology, where etcd runs on the control plane nodes, or an external etcd topology, with at least three control plane nodes behind a TCP load balancer on port 6443. Each API request lands on whichever kube-apiserver the load balancer selects, so a node with a different policy or a missing flag records different events for the same action. Investigators then find gaps that depend on the node that handled the request, and a detection rule written against one node can miss activity handled by another. Keep the audit policy and flags in version control, apply them to all nodes from the same source, and after each change confirm that every node's kube-apiserver static pod manifest carries the same audit flags and mounts the same policy file.

The Kubernetes version skew policy requires kube-apiserver to be upgraded one minor version at a time, and before kube-controller-manager, kube-scheduler and kubelets. Because kube-apiserver moves first, it is the component where audit behavior changes earliest in an upgrade. Policy rules that name specific resources, API groups or stages can behave differently on the target minor version, so check the release notes for that version before the upgrade. Then run the existing policy against a test cluster on the target version, confirm that kube-apiserver starts cleanly with the flags, and verify that audit events still appear for the resources your detections depend on. Record this check in the change record for every minor step, not only in the initial setup.

The project maintains the three most recent minor releases. As of September 2026 these were 1.37 (end of life October 28, 2027), 1.36 (June 28, 2027) and 1.35 (February 28, 2027), according to the Kubernetes releases page. A cluster that falls outside this window stops receiving upstream fixes, so plan audit configuration into every upgrade window scheduled before that date. Clusters still on 1.35 have the earliest deadline. Add the audit validation step to the upgrade runbook with a named owner, and if a cluster is several minor versions behind, repeat the check at each intermediate step rather than only at the final target. Confirm with your distribution vendor whether its support dates match the upstream dates, since a vendor may ship and support builds on a different schedule.

Roll the change out one control plane node at a time, and keep a rollback path for each node. Before editing, copy the current audit policy file and the kube-apiserver static pod manifest on that node to a dated location outside the manifests directory. Apply the change to one node, wait for its kube-apiserver to restart, and generate a known test event, such as creating and deleting a labeled ConfigMap in a non-production namespace. Confirm that the event appears in the audit log or webhook backend at the expected level before moving to the next node. If an API server fails to start or expected events are missing, restore the saved manifest and policy file on that node. The load balancer continues to route to the remaining nodes while you do this. Ask your team to document and test these rollback steps on a non-production cluster before the first production change.

Questions buyers ask about Kubernetes audit logging

How much does Kubernetes audit logging implementation cost?

Cost depends on a fixed scope that is agreed in writing before work starts. The scope covers audit policy design, configuration on each control plane node, SIEM integration, verification and documentation. The main cost drivers are:

  • Control plane nodes: each node needs the same configuration applied and checked. The kubeadm high availability guide describes a layout with at least three control plane nodes.
  • SIEM path: a direct forwarder, a log collector or an existing pipeline each require different work.
  • Number of teams: security, platform and application owners may each shape the policy.
  • Existing evidence: prior reviews and documented controls reduce the documentation work.

Ask any quote to separate one-time work from recurring items, such as policy reviews after Kubernetes upgrades and SIEM rule maintenance. Also ask what you provide, including storage for retained logs, which is a recurring infrastructure cost on your side.

How long does a Kubernetes audit logging project take?

DeployOpen agrees timelines in writing for a fixed scope, so the schedule is set in the proposal before work begins. The same drivers that affect cost also affect duration. The largest variables are how quickly change windows on control plane nodes are approved, how many SIEM owners must review the event format, and whether the policy needs sign-off from several people. A single cluster with an existing SIEM ingestion path moves faster than a multi-cluster design that needs a new log pipeline. Ask for the proposed phases, the client actions each phase depends on, and the acceptance test that closes the work. Use those items to check whether the dates depend on your approvals or on the implementation work itself.

What do we need to provide for a Kubernetes audit logging project?

The work needs three things from your side. First, access to the control plane nodes or, where change control is strict, a defined change process that lets changes run through your own pipelines and approvals. Second, SIEM access, including a way to confirm event formats, create receivers or parsing rules, and view test events in the destination. Third, named owners who approve the audit policy. The policy decides which resources and users are logged at each level and how long logs are kept, so security, platform and application owners should be identified early. You should also provide a test cluster or a maintenance window for verification before any production change.

Can our internal platform team set up Kubernetes audit logging alone?

Yes. An internal platform team can implement Kubernetes audit logging using the official Kubernetes documentation and a written test plan. The work is mostly careful reading of the audit policy options, choosing levels per resource, configuring the API server on each control plane node and verifying the output. Teams with a sound change process and someone who owns the SIEM pipeline usually find the work manageable. The main risk is verification. A policy that logs too little leaves gaps, and one that logs too much can fill storage or expose sensitive data in request bodies. The test plan should cover each audit level, sample create, update, delete and read actions on Secrets and RBAC objects, the SIEM alert path and rollback steps. If internal capacity is limited, DeployOpen can deliver the same work as a fixed-scope engagement.

How do we choose audit levels for each resource type?

Start from the questions your reviews need to answer. Audit levels control how much of each request is recorded, and the audit policy rules are evaluated in order, so the first matching rule sets the level. Metadata-level logging suits high-volume reads where the actor, verb and resource are enough. Request-level logging suits write operations on sensitive resources, where the request content helps an investigation. Avoid recording request bodies for Secrets, because they can contain credential values. Omit stages you do not need, and keep the rule order documented. Test each rule with a known request in a test cluster, then confirm the event fields appear in the SIEM. Have the policy owners approve the final table before production rollout.

What breaks when Kubernetes audit events reach a SIEM?

Most failures sit in the path between the API server and the SIEM. Common problems include:

  • A log file that rotates without the collector following it, so events stop arriving silently.
  • A webhook backend that times out or drops events under load.
  • Fields that the SIEM parses as plain text, so searches on user or resource fail.
  • Clock differences between nodes, which break timeline correlation.
  • Retention that deletes events before an investigation or review ends.

Check each hop by generating known actions and tracing them to the final index. Monitor the collector for backlog and dropped events, because an audit gap is often found only during an incident. Document the retention period and the owner of each stage so the gaps can be traced quickly.

How do we confirm audit events are complete and searchable?

Run a scripted set of known actions under a named test account. Examples include creating a test Secret, changing a role binding and deleting a test Pod. Then confirm that each action appears in the SIEM with the expected user, verb, resource, namespace, timestamp and response code. Check that Secret values do not appear in any logged request body. Repeat the test after every policy change and after each Kubernetes upgrade, since upgrades can change defaults. Test the SIEM alerts too, for example by making a controlled change to a cluster-admin binding and confirming the alert fires. Keep the results with the documentation so that assessors can review the evidence.

How DeployOpen works on this

DeployOpen scopes Kubernetes audit logging as a written deliverable inside your own clusters, covering the audit policy, log and webhook backends, retention and SIEM shipping. Work is delivered fixed-scope, with the policy, configuration and verification agreed before the build starts. Each engagement is shaped by your control plane, your compliance obligations and the volume of events your teams need to investigate.

How we scope

  • We map which API requests your compliance and incident response teams need to see, and at what detail.
  • The written scope names the audit policy rules per resource, the log and webhook backends, and retention settings.
  • We confirm the SIEM receiving audit events, its ingestion format and who owns the alert content.

How we build

  • We write the audit policy file for the control plane, with levels set per resource group and reasons recorded for each.
  • We configure the log or webhook backend on each control plane node, using your distribution's supported flags and paths.
  • We set retention and rotation values for the audit log files and test that events reach the SIEM before handover.

How we hand over

  • You receive the audit policy, backend configuration and retention settings as versioned files in your repository.
  • Test evidence shows sample requests at each audit level, with the expected events found in the SIEM.
  • Runbooks cover policy changes, log rotation checks, SIEM parser updates and what to do when events stop arriving.

How we support

  • Ongoing support is available as a retainer, covering policy changes after cluster upgrades and new resource types.
  • Retainers can include reviewing audit volume and retention as your clusters and workloads grow.
  • Compliance evidence is prepared for your assessors, who decide whether the controls meet the framework.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.