Overview

Kubernetes Audit Log Monitoring provides deep visibility into all interactions with the Kubernetes API server. Every request made to the Kubernetes API is recorded, including requests from:
  • Control plane components (scheduler, controllers)
  • Node components (kubelet, kube-proxy)
  • Cluster services
  • Users interacting through kubectl
  • Applications calling the Kubernetes API
When enabled, Kubernetes Audit Log Monitoring helps you:
  • Track all API server activity in the cluster
  • Detect unauthorized access and privilege escalation
  • Identify RBAC policy misconfigurations
  • Monitor resource lifecycle events (create, update, delete)
  • Investigate security incidents and suspicious activity
  • Diagnose permission issues and API failures

Requirements


Enabling Kubernetes Audit Logs

For more information about setting up Kubernetes audit logs, see Kubernetes Auditing. For K8s Selfhosted, configure the K8s server with audit logging enabled. To enable audit logs in Kubernetes:
  1. Audit logs are disabled by default in Kubernetes. To enable them in your API server configuration, specify an audit policy file path:
  1. Create the policy file at /etc/kubernetes/audit-policies/policy.yaml to specify the types of API requests you want to capture in your audit logs. Audit policy rules are evaluated in order. The API server follows the first matching rule it finds for each type of operation or resource. Example of an audit policy:
Example minimal audit policy:
This example policy file configures the API server to log at the highest level of detail for certain types of cluster-changing operations (update, patch, create, delete). It also tracks requests to the subjectaccessreviews resource at the highest level to help troubleshoot authentication delegation issues. You may want to reduce the level of verbosity to Metadata for endpoints that contain sensitive data, such as the tokenreviews resource. Datadog also omits the RequestReceived stage from logs. In the last section, for everything that was not explicitly configured by the previous rules, the policy is configured to log at Metadata level. As audit logs might be verbose, you can choose to exclude less critical actions/verbs, such as operations that don’t change the cluster state like list, watch, and get. After updating the configuration, restart the K8s server.

Installing the Atatus Agent Helm Chart

If the Atatus agent is not installed in your Kubernetes cluster, first install the agent by following the Kubernetes installation guide Install Atatus Agent using Helm Once the agent is installed, you can update the Helm chart to enable Kubernetes audit log monitoring. Update Helm Repository Add the Atatus Helm repository if it is not already configured:
Pull the Helm chart locally: Download the chart locally to modify configuration values:
Upgrade the Existing Agent

This upgrades the existing agent deployment and applies the configuration changes required for Kubernetes audit log collection.

Agent Configuration

The Atatus agent must be configured to:
  1. Enable log collection
  2. Mount the Kubernetes audit log directory
  3. Read the audit log file

Enable Log Collection

Edit values.yaml:
Without this setting, file logs will not be shipped.

Mount Kubernetes Audit Logs

Kubernetes audit logs are written on the node filesystem by the API server. The Atatus agent must mount this directory to read and ship the logs. Add the audit log directory as a hostPath volume in values.yaml.
Mount the Directory Inside the Agent Container Mount the host directory into the agent container so the agent can read the audit log file.
This maps the host directory:
to the container path:
The agent will read audit logs from this mounted directory. Common Audit Log Paths The exact audit log directory depends on the Kubernetes distribution. Verify the Log File Exists Before deploying the agent, verify that the audit log file exists on the node:
Example:

Update the DaemonSet Template

Edit template/daemonset.yaml: To enable file log collection, the files.yml configuration must be mounted inside the agent container. Update the templates/daemonset.yaml file in the Helm chart to mount the configuration file. Add the following volume mount inside the container volumeMounts section: If the audit log file does not exist, ensure Kubernetes audit logging is enabled on the API server.

Configure Log Collection

Configure the agent to collect the audit log file. Edit values.yaml:
The file path inside the container must match the mounted directory.

K3s Full Example Setup

The following example shows a complete K3s setup without changing the generic Kubernetes configuration above.

1. Create the K3s audit policy file

Create /var/lib/rancher/k3s/server/audit.yaml on the K3s server:

2. Update the K3s server config

Edit /etc/rancher/k3s/config.yaml:
Restart K3s:
Verify the audit log file exists:

3. K3s-specific values.yaml example

Because K3s writes audit logs to /var/lib/rancher/k3s/server/logs/audit.log, use that host path in the Helm values:

4. Update the DaemonSet template for files.yml

Add the following mount inside the container volumeMounts section in templates/daemonset.yaml:
This ensures the files.yml configuration from values.yaml is mounted into the Atatus agent container.

5. Deploy and verify

If the file exists inside the pod, the agent can collect Kubernetes audit logs from the K3s server.

Deploy the Agent

Deploy or upgrade the Helm chart:
Verify the agent pod can access the audit log file:
If the file exists and log collection is enabled, the agent will begin shipping Kubernetes audit logs.

Example Security Events

Kubernetes audit logs capture important cluster activities such as: Example audit event:

Viewing Audit Events

Audit events appear in: Security → Cloud SIEM → Kubernetes Audit Logs Each event includes:
  • User or service account
  • Resource type and namespace
  • API operation (create, update, delete)
  • Source IP address
  • Request status
  • Timestamp
  • Audit stage
These events provide a full audit trail of activity inside your Kubernetes cluster.