Hands-on Lab·Certified Kubernetes Security Specialist
Enabling Kubernetes Audit Logging
Every guide before this one changed something and nothing wrote down who did it. This is the change that fixes that: a policy file, five flags on the apiserver, and an honest look at the volume it produces.
Monitoring and Runtime Guide 32 of 40 Advanced
- Kubernetesapiserver v1.36.4, kubelet v1.36.3
- Runtimecontainerd 2.2.6
- CNICilium 1.18.1
- Built withkubeadm v1.36.3
- TimeAbout 18 min
apiserver v1.36.4 on a single-node kubeadm cluster. The policy is audit.k8s.io/v1, which has been stable since 1.12 and is what the exam uses.
- Host kernel7.0.0-29
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| CKA8001 | 192.168.0.56 | Ubuntu 26.04 LTS | Single Node (control plane, untainted) | 2 Core | 4 GB | 50 GB |
This guide includes
Use this because nothing before it wrote down who did what. This matters because a kubeadm cluster records nothing by default - and the policy file, rather than the flag, is where the whole design lives.
- asking two questions about what this cluster records today, and getting the same answer twice
- writing the policy, where rules are evaluated in order and first match wins
- turning it on, then checking the API server is still healthy afterwards
- reading the first thing it recorded, so the shape of the file is clear
Before you start
- guide 20 - the same manifest, the same restart, the same recovery drill.
-
What this cluster records today
-
The policy, which is the whole design
-
Turn it on
-
The first thing it recorded