Skip to content
Français
Account: not signed in, sync available My learning
Select theme
Français

CIS Kubernetes Benchmark: audit your cluster security

By updated

Improve this page

Logo Kubernetes

The CIS Kubernetes Benchmark is a set of security recommendations developed by the Center for Internet Security (CIS). kube-bench is an open source tool that automatically checks your cluster against these recommendations. In a few minutes, you get a detailed report of the points to fix.

The CIS Benchmark belongs to the Cluster Setup domain of the CKS certification, which weighs 15% of the exam. The curriculum asks you to use the CIS benchmark to review the configuration of the Kubernetes components (etcd, kubelet, kubedns, kubeapi), which comes down to knowing how to run a tool like kube-bench and knowing how to interpret what it returns. This guide works mostly on the second skill.

What you will learn

  • Place the CIS Kubernetes Benchmark and what it really covers
  • Install kube-bench as a verified binary, as a package or as a Kubernetes Job
  • Run an audit and target the right sections with --targets
  • Read the PASS, FAIL and WARN statuses and apply the suggested remediations
  • Harden the static Pods of the control plane (--profiling=false, --service-account-lookup=true, --tls-min-version) and check the result
  • Tell a real gap from a false positive caused by your distribution
  • Automate the audit in CI/CD and with a CronJob

What is the CIS Kubernetes Benchmark?

CIS is a non-profit organization that publishes benchmarks, lists of security controls, for many technologies. The Kubernetes one is widely used to harden a cluster.

What the benchmark covers

The benchmark analyses the configuration of all the Kubernetes components:

DomainComponents checkedExample controls
Control PlaneAPI Server, Controller Manager, Scheduler, etcdFile permissions, security arguments
Worker NodesKubelet, network configurationKubelet authentication, certificate rotation
PoliciesRBAC, Service Accounts, Network PoliciesLeast privilege, network segmentation
Pod SecurityPod Security Standards, Security ContextsNon-root containers, capabilities

Recommendation levels

Each control in the benchmark is classified along two axes:

ClassificationMeaning
Level 1Basic recommendations, easy to implement, minimal impact on functionality
Level 2Advanced recommendations, may need more planning
ScoredThe control affects the compliance score
Not ScoredRecommendation, but not counted in the score

In recent versions of the benchmark, the kube-bench output no longer shows "Scored" and "Not Scored" but (Automated) and (Manual). The distinction is the same: an Automated control is evaluated by the tool and counts toward the score, while a Manual control needs a human check. The --scored and --unscored options let you restrict a run to one of the two categories.

In kube-bench 0.15.6, the cis-1.12 profile, which follows version 1.12 of the CIS Kubernetes Benchmark, matches Kubernetes 1.32 to 1.34, and the table stops at 1.34. On a newer cluster, such as 1.37, kube-bench silently falls back to the closest entry below it, so to cis-1.12. That choice relies on a detection that can be wrong: on a newer version or on a particular distribution, first check the compatibility matrix. A wrongly chosen profile produces FAIL results that mean nothing.

What does kube-bench not do?

kube-bench checks CIS compliance only for Kubernetes configurations. It does not cover other aspects of security:

What kube-bench doesWhat kube-bench does NOT do
Check the permissions of configuration filesScan container images for vulnerabilities
Check the arguments of the K8s componentsDetect suspicious runtime behavior
Audit RBAC configurationsAnalyse network traffic
Check the kubelet settingsScan application dependencies for CVEs

For complete security, combine kube-bench with:

  • Trivy: scanning of image vulnerabilities and IaC configurations
  • Falco: runtime detection of abnormal behavior
  • Audit Logs: traceability of the actions on the API

How do you install kube-bench?

kube-bench is developed by Aqua Security and available as open source. Several installation methods exist depending on your context.

Option 1: binary installation (control plane)

This method is ideal for self-managed clusters where you have SSH access to the nodes. The project publishes a checksums file next to each archive: download both and check the digest before extracting. That is what separates a controlled installation from a blind download on a control plane machine.

Terminal window
# Create the installation directory
sudo mkdir -p /opt/kube-bench
cd /tmp
# Download the archive AND the checksums file published by the project
curl -sSLO https://github.com/aquasecurity/kube-bench/releases/download/v0.15.6/kube-bench_0.15.6_linux_amd64.tar.gz
curl -sSLO https://github.com/aquasecurity/kube-bench/releases/download/v0.15.6/kube-bench_0.15.6_checksums.txt
# Check integrity: the output must show "... : OK"
sha256sum --check --ignore-missing kube-bench_0.15.6_checksums.txt
# Extract the files only if the check passed
sudo tar -xzf kube-bench_0.15.6_linux_amd64.tar.gz -C /opt/kube-bench
# Add to the PATH
sudo mv /opt/kube-bench/kube-bench /usr/local/bin/

The --ignore-missing option stops sha256sum from failing on the other architectures listed in the checksums file, which you did not download.

Check:

Terminal window
kube-bench version
# Output: 0.15.6

Option 2: installation with a package manager

The .deb and .rpm packages published by the project have an advantage over the archive: they install the binary and the cfg configuration directory in the right place, which avoids the error described above. They are not served by a repository, so they will not update themselves: you stay responsible for version tracking. As with the archive, the checksums file covers these packages too.

For Debian/Ubuntu:

Terminal window
curl -sSLO https://github.com/aquasecurity/kube-bench/releases/download/v0.15.6/kube-bench_0.15.6_linux_amd64.deb
curl -sSLO https://github.com/aquasecurity/kube-bench/releases/download/v0.15.6/kube-bench_0.15.6_checksums.txt
sha256sum --check --ignore-missing kube-bench_0.15.6_checksums.txt
sudo dpkg -i kube-bench_0.15.6_linux_amd64.deb

For RHEL/CentOS:

Terminal window
curl -sSLO https://github.com/aquasecurity/kube-bench/releases/download/v0.15.6/kube-bench_0.15.6_linux_amd64.rpm
curl -sSLO https://github.com/aquasecurity/kube-bench/releases/download/v0.15.6/kube-bench_0.15.6_checksums.txt
sha256sum --check --ignore-missing kube-bench_0.15.6_checksums.txt
sudo rpm -ivh kube-bench_0.15.6_linux_amd64.rpm

Option 3: running as a Kubernetes Job

This method is recommended for managed clusters (EKS, AKS, GKE) or when you have no SSH access to the nodes:

Terminal window
# Deploy the kube-bench job (workers only)
kubectl apply -f https://raw.githubusercontent.com/aquasecurity/kube-bench/v0.15.6/job.yaml
# Wait for the run to finish
kubectl wait --for=condition=complete job/kube-bench --timeout=60s
# Fetch the results
kubectl logs job/kube-bench

To scan the control plane and etcd from a Job (self-managed clusters), use a Job with hostPID: true and the volumes it needs:

apiVersion: batch/v1
kind: Job
metadata:
name: kube-bench-cp
namespace: kube-system
spec:
template:
spec:
hostPID: true
nodeSelector:
node-role.kubernetes.io/control-plane: ""
tolerations:
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
containers:
- name: kube-bench
image: aquasec/kube-bench:v0.15.6@sha256:861900910eec45b54a97e4a2af81b16fae7203d768f7f8e7de3b7456807870f5
command: ["kube-bench", "run", "--targets", "master,controlplane,etcd,node"]
volumeMounts:
- name: var-lib-etcd
mountPath: /var/lib/etcd
readOnly: true
- name: etc-kubernetes
mountPath: /etc/kubernetes
readOnly: true
- name: var-lib-kubelet
mountPath: /var/lib/kubelet
readOnly: true
restartPolicy: Never
volumes:
- name: var-lib-etcd
hostPath:
path: /var/lib/etcd
- name: etc-kubernetes
hostPath:
path: /etc/kubernetes
- name: var-lib-kubelet
hostPath:
path: /var/lib/kubelet

Two fields of this manifest are not decorative. hostPID: true gives the Pod visibility on the node's processes, without which kube-bench sees neither kube-apiserver nor etcd and every control plane check fails. The hostPath mounts give it access to the configuration files and certificates it has to inspect. Removing either one does not make the scan safer, it makes it wrong.

How do you run the CIS checks?

kube-bench reads the real configuration of the components on the node where it runs: command line arguments, manifest files, permissions on certificate files. It is therefore not a network scan but a local inspection, and that explains the following constraint: the scan must run on the node it evaluates, and the control plane checks give a usable result only on a control plane node.

You saw the two ways to launch it during installation. The binary installed on the node suits a one-off check; the Kubernetes Job suits a cluster you have no SSH access to, or a check you want to be able to replay.

Full cluster scan

On a control plane node (with the binary installed), run a full scan:

Terminal window
# Scan with auto-detection of the K8s version and the config files
sudo kube-bench run

Each line of the result carries a status in square brackets, the control number, its text and its evaluation mode (Automated or Manual):

[INFO] 1 Control Plane Security Configuration
[INFO] 1.1 Control Plane Node Configuration Files
[PASS] 1.1.1 Ensure that the API server pod specification file permissions are set to 600 or more restrictive (Automated)
[PASS] 1.1.2 Ensure that the API server pod specification file ownership is set to root:root (Automated)
[FAIL] 1.1.9 Ensure that the Container Network Interface file permissions are set to 600 or more restrictive (Manual)
[WARN] 1.1.12 Ensure that the etcd data directory ownership is set to etcd:etcd (Manual)

How do you read the results?

Treat these four statuses with different priorities. A FAIL is a measured gap, one kube-bench was able to rule on: that is where you start. A WARN flags a control the tool cannot evaluate by itself, often because it depends on a path or a component that only a human can confirm; it does not mean "less serious". Never compute a compliance percentage by ignoring the WARN results, you would get a flattering and false score.

StatusMeaningAction
PASSThe control is compliantNo action required
FAILThe control failsFix required
WARNManual check recommendedTo investigate
INFOContextual informationRead only

Exporting the results

The format matters depending on who receives it. Text suits an occasional human reading, JSON an automated process or a dashboard, and JUnit a CI platform that can show failing tests directly in a pipeline interface. The --outputfile option also exists and avoids the shell redirection, which is useful when the program writes log messages to standard output.

Terminal window
# Export to a text file
sudo kube-bench run > kube-bench-report.txt
# Export to JSON (for CI/CD integration)
sudo kube-bench run --json > kube-bench-report.json
# Export to JUnit (for CI integration)
sudo kube-bench run --junit > kube-bench-report.xml

Scanning specific components

A trap to know about: the names passed to --targets match the file names of the profile, in cfg/<benchmark>/. But master and controlplane are two distinct targets, not an old and a new name. In the cis-1.12 profile:

TargetCIS sectionWhat it contains
master1, Control Plane Security ConfigurationManifest permissions, arguments of the API Server, the scheduler and the controller manager
etcd2, Etcd Node Configurationetcd configuration and certificates
controlplane3, Control Plane ConfigurationAuthentication, authorization, audit logging
node4, Worker Node Security ConfigurationKubelet files and settings
policies5, Kubernetes PoliciesRBAC, Service Accounts, Pod Security, Network Policies

In other words, to audit the control plane components (API Server, Controller Manager, Scheduler), the target is master, not controlplane. You can list the content of the profile to make sure: ls /opt/kube-bench/cfg/cis-1.12/.

Terminal window
# Control plane component configuration (section 1)
sudo kube-bench run --targets master
# Control plane authentication and audit configuration (section 3)
sudo kube-bench run --targets controlplane
# Scan the worker nodes only
sudo kube-bench run --targets node
# Scan etcd only
sudo kube-bench run --targets etcd
# Scan the policies only
sudo kube-bench run --targets policies
# Several targets in one pass
sudo kube-bench run --targets master,etcd,controlplane

How do you interpret the results and fix the problems?

A kube-bench report reads against intuition: the number of PASS results tells you nothing, it is the FAIL and above all the WARN results that carry the information. Remember the distinction seen above: a FAIL is a measured gap, a WARN is a control the tool sends back to you to examine.

Handling a report means fixing the FAIL results first, then ruling on each WARN by deciding what applies to your context, and recording that decision. An unresolved WARN comes back with every scan.

What does a real scan return?

Here is the summary produced on a two-node lab cluster. The numbers matter less than their distribution:

Output
== Summary master ==
39 checks PASS
10 checks FAIL
11 checks WARN
0 checks INFO
== Summary etcd ==
7 checks PASS
0 checks FAIL
0 checks WARN
== Summary controlplane ==
0 checks PASS
0 checks FAIL
5 checks WARN

Across the three sections shown, this cluster has 10 FAIL and 16 WARN results. The WARN results outnumber the FAIL ones, and that is the real work: ten technical fixes, but also sixteen decisions to make and document.

The controlplane section is the extreme case, with 0 PASS, 0 FAIL and 5 WARN: none of its controls can be automated, they all have to be ruled on by hand. A report that shows "no failure" on this section therefore says nothing at all about its compliance.

Sample report

After the per-section summary, the output ends with the remediations that match the failing controls. This block makes kube-bench directly usable: it does not just state a finding, it gives the command or argument to apply. The remediations stay deliberately generic, with placeholders such as <path/to/cni/files>: it is up to you to find the real path on your node.

== Remediations master ==
1.1.9 Run the below command (based on the file location on your system) on the control plane node.
For example, chmod 600 <path/to/cni/files>
1.1.12 On the etcd server node, get the etcd data directory, passed as an argument --data-dir,
from the command 'ps -ef | grep etcd'.
Run the below command (based on the etcd data directory found above).
For example, chown etcd:etcd /var/lib/etcd

What are the most common fixes?

The four fixes below deal with typical FAIL results on a freshly installed kubeadm cluster. They are ordered by increasing risk: the first two touch file permissions and have no effect on the service, the next ones change the behavior of the cluster and can make it unavailable if there is a syntax error. Back up the manifest before editing it and check that the component restarts properly before moving on.

  1. File permissions of the configuration files

    Terminal window
    # Fix the API Server permissions
    sudo chmod 600 /etc/kubernetes/manifests/kube-apiserver.yaml
    # Fix the scheduler permissions
    sudo chmod 600 /etc/kubernetes/manifests/kube-scheduler.yaml
    # Fix the controller manager permissions
    sudo chmod 600 /etc/kubernetes/manifests/kube-controller-manager.yaml
  2. Ownership of the etcd files

    Terminal window
    # Check the etcd data directory
    ps -ef | grep etcd | grep data-dir
    # Fix the owner
    sudo chown -R etcd:etcd /var/lib/etcd
  3. Security arguments of the API Server

    Edit /etc/kubernetes/manifests/kube-apiserver.yaml:

    spec:
    containers:
    - command:
    - kube-apiserver
    # Enable audit logging
    - --audit-log-path=/var/log/kubernetes/audit/audit.log
    - --audit-policy-file=/etc/kubernetes/audit-policy.yaml
    - --audit-log-maxage=30
    - --audit-log-maxbackup=10
    - --audit-log-maxsize=100
    # Enable secrets encryption
    - --encryption-provider-config=/etc/kubernetes/enc/enc.yaml
  4. Kubelet configuration

    Edit /var/lib/kubelet/config.yaml:

    # Disable anonymous authentication
    authentication:
    anonymous:
    enabled: false
    # Enable certificate rotation
    rotateCertificates: true
    # Enable webhook authorization
    authorization:
    mode: Webhook

How do you harden the three control plane components?

A kubeadm cluster fresh out of the installation leaves the profiler active on the three control plane components. The profiler is the /debug/pprof/ endpoint, which reveals the memory and load of a component. The audit flags it under three numbers: 1.2.15 for kube-apiserver, 1.3.2 for kube-controller-manager and 1.4.1 for kube-scheduler. Fixing a single component therefore leaves two doors open. On the API server, two other options are written explicitly in the manifest, without the audit flagging them: the verification of service account tokens, already active by default, no longer depends on a default that could change, and the TLS floor refuses clients using old TLS.

A static Pod is a Pod that the kubelet starts itself from a file placed on the node. On a kubeadm cluster, these files live in /etc/kubernetes/manifests/: kube-apiserver.yaml, kube-controller-manager.yaml and kube-scheduler.yaml. The settings go in as arguments of the command list of the first container.

/etc/kubernetes/manifests/kube-apiserver.yaml
spec:
containers:
- command:
- kube-apiserver
- --profiling=false
- --service-account-lookup=true
- --tls-min-version=VersionTLS12

The other two manifests only receive - --profiling=false, after the kube-controller-manager command and the kube-scheduler command. On the API server, --service-account-lookup=true asks it to check that a presented service account token still exists, and --tls-min-version refuses TLS versions lower than the one given.

The kube-apiserver documentation lists the accepted values: VersionTLS10, VersionTLS11, VersionTLS12 and VersionTLS13. VersionTLS12 is a common floor, VersionTLS13 is stricter but excludes clients that only speak TLS 1.2. An argument already present in the list is not repeated: change its value instead of adding a second line.

The kubelet watches this directory and recreates the static Pod as soon as its file changes, with no command to run. During this restart, the API server is unavailable for a few seconds, so kubectl may fail until it comes back. A syntax error, or an unknown argument, prevents the container from starting and leaves the API out of service: keep a copy of the manifest outside /etc/kubernetes/manifests/ before editing it (a copy left in that directory would be read as a second static Pod).

To check, wait for the three control plane Pods to be Running again with kubectl -n kube-system get pods. Then ask the profiler to answer with kubectl get --raw /debug/pprof/: the command must now fail, while kubectl get --raw /version must still return the cluster's gitVersion.

Finally, run kube-bench again on the control plane section (--targets master): controls 1.2.15, 1.3.2 and 1.4.1 must switch to PASS, and the number of FAIL results must go down. If the Pod stays in error, sudo crictl ps -a followed by sudo crictl logs <id> gives the reason for the refusal.

Do not turn off the API server's anonymous authentication (--anonymous-auth=false) in this same move. The probes that kubeadm writes into the API server manifest query /livez and /readyz without authenticating: with anonymous authentication turned off, the kubelet sees them fail and restarts the API server in a loop.

What profiles exist for managed clusters?

kube-bench ships profiles specific to the main cloud providers. Their names change regularly: check the official documentation for the most recent versions.

Your own installation is the reference: each profile is a subdirectory of cfg/. A simple ls tells you exactly what your binary accepts behind --benchmark, and avoids the can't find configuration for error on an invented profile name.

Terminal window
ls /opt/kube-bench/cfg/
# ack-1.0 aks-1.0 aks-1.7 aks-1.8 cis-1.10 cis-1.11 cis-1.12 ...
# eks-1.5.0 eks-1.7.0 eks-1.8.0 gke-1.6.0 gke-1.8.0 gke-1.9.0
# k3s-cis-1.9 rke2-cis-1.8 rh-1.8 cis-1.24-microk8s ...
Terminal window
# AWS EKS specific configuration
kubectl apply -f https://raw.githubusercontent.com/aquasecurity/kube-bench/v0.15.6/job-eks.yaml
# Or via Docker (check the benchmark available for your EKS version)
docker run --rm -v /etc:/etc:ro -v /var:/var:ro \
aquasec/kube-bench:v0.15.6@sha256:861900910eec45b54a97e4a2af81b16fae7203d768f7f8e7de3b7456807870f5 run --benchmark eks-1.5.0

A syntax detail makes the command fail without explaining why: the patch number is part of the profile name. eks-1.8 is refused, you have to write eks-1.8.0. kube-bench 0.15.6 ships the profiles eks-1.0.1, eks-1.1.0, eks-1.2.0, eks-1.5.0, eks-1.7.0 and eks-1.8.0, as well as eks-stig-kubernetes-v1r6 for environments subject to the DoD STIGs.

How do you integrate kube-bench into CI/CD?

A scan launched by hand only detects a regression the day someone thinks of running it again. The point of automating it is not to save time but to turn compliance into a permanent constraint: a change that degrades the cluster configuration fails when it is proposed, not six months later during an audit.

The two examples below answer two needs: the GitLab pipeline blocks a change before it goes to production, the CronJob watches for cluster drift over time. In both cases, failing the job as soon as a control fails is what gives the setup its value. A pipeline that produces a report without ever blocking becomes a file nobody opens.

GitLab CI pipeline

This pipeline runs kube-bench on each merge request or deployment, generates JSON and JUnit reports, and fails if CIS controls fail, in order to catch security regressions before production. It assumes the job runs on the node to audit, for example with a runner installed on a cluster node: kube-bench reads the files and processes of the machine where it runs, so an ordinary runner would audit its own machine, not your cluster.

security-audit:
stage: security
image: aquasec/kube-bench:v0.15.6@sha256:861900910eec45b54a97e4a2af81b16fae7203d768f7f8e7de3b7456807870f5
script:
# Generate the JSON report for analysis
- kube-bench run --json > kube-bench-results.json
# Generate the JUnit report for GitLab
- kube-bench run --junit > kube-bench-results.xml
- |
FAIL_COUNT=$(jq '[.Controls[].results[] | select(.status == "FAIL")] | length' kube-bench-results.json)
if [ "$FAIL_COUNT" -gt "0" ]; then
echo "Failure: $FAIL_COUNT CIS controls failing"
exit 1
fi
artifacts:
paths:
- kube-bench-results.json
reports:
junit: kube-bench-results.xml

kube-bench offers a more direct alternative to counting with jq: the --exit-code option sets the exit code used when at least one control fails. kube-bench run --exit-code 1 is then enough to make the job fail, without depending on the JSON format. Keep the jq variant if you want to tolerate a threshold of known failures rather than an absolute zero.

This option is not a convenience, it is the condition for the control to exist. On the same cluster, the same command, with and without it:

CommandFailing controlsExit codeKubernetes Job
kube-bench run --targets=master100Succeeded
kube-bench run --targets=master --exit-code 1101Failed

Without the option, kube-bench succeeds despite ten failing controls. A pipeline that just runs the command and looks at its return code will therefore never report anything, and will give the impression of a passing check for months.

Kubernetes CronJob

A one-off audit says nothing about drift. The CronJob below runs kube-bench every night and makes visible any regression introduced by a cluster update or a manual change. Two points of vigilance: the image is pinned to a precise version rather than latest, otherwise your results change while nothing moved on the cluster side; and hostPID: true combined with the mounts of /etc/kubernetes gives this Pod very broad access, to be reserved for a dedicated namespace with restricted RBAC. For the Job to go to Failed when a control fails, add --exit-code and 1 to args.

apiVersion: batch/v1
kind: CronJob
metadata:
name: kube-bench-scheduled
namespace: security
spec:
schedule: "0 2 * * *" # Every day at 2 a.m.
jobTemplate:
spec:
template:
spec:
hostPID: true
containers:
- name: kube-bench
image: aquasec/kube-bench:v0.15.6@sha256:861900910eec45b54a97e4a2af81b16fae7203d768f7f8e7de3b7456807870f5
command: ["kube-bench"]
args: ["run", "--json"]
volumeMounts:
- name: var-lib-kubelet
mountPath: /var/lib/kubelet
readOnly: true
- name: etc-kubernetes
mountPath: /etc/kubernetes
readOnly: true
volumes:
- name: var-lib-kubelet
hostPath:
path: /var/lib/kubelet
- name: etc-kubernetes
hostPath:
path: /etc/kubernetes
restartPolicy: Never

What are false positives, and how do distributions affect them?

kube-bench can report failures that are really false positives, depending on the Kubernetes distribution used. Each distribution has its own configuration conventions.

Distributions with dedicated profiles

kube-bench automatically detects some distributions and applies the right profile:

DistributionProfileSpecifics
RKE2rke2-cis-*Files in /etc/rancher/rke2/, built-in etcd
RKErke-cis-*Control plane components in containers
k3sk3s-cis-*Lightweight architecture, non-standard paths
OpenShiftrh-*Specific Red Hat profile (rh-0.7 to rh-1.8)
kubeadmcis-*Standard CIS profile
microk8scis-1.24-microk8sProfile dedicated to snap paths
Alibaba ACKack-1.0Provider profile
Tanzu TKGItkgi-1.2.53Provider profile

Common examples of false positives

A false positive often follows the same pattern: the control looks for a file or a process at a standard location that your distribution has moved. Before concluding, read the text of the control, find the real path on your node with ps -ef or ls, and compare. If the expected configuration does exist but elsewhere, it is a false positive; if it exists nowhere, it is a real gap.

One rule before applying anything: do not blindly fix every failure. Some gaps are intentional, others come from your distribution, which puts a file elsewhere or already provides the protection another way. Applying a remediation without understanding what it changes is a good way to break a cluster to satisfy a report.

Three common examples:

  • On RKE2 and k3s, the configuration files are in /etc/rancher/ instead of /etc/kubernetes/, and etcd may be built into the binary rather than started as a separate process.
  • On Kubespray, the etcd owner may be root instead of etcd:etcd depending on the configuration, and some security arguments are in systemd drop-in files.
  • On a managed cluster, the control plane checks fail because you have no access to the master nodes.

How do you document exceptions?

An unwritten exception becomes a gap again at the next audit, and nobody remembers why it was accepted. Keep an exceptions file, versioned next to your infrastructure, and require three pieces of information for each entry: the technical reason, the person who approved it and the date. That document, and not the raw kube-bench report, is what you will show an auditor.

The format below is a team convention, not a format read by kube-bench. For the tool to really skip a control at run time, use --skip, for example --skip 1.1.12,4.2.6.

# exceptions-cis.yaml - Controls skipped on purpose
exceptions:
- control: "1.1.12"
reason: "etcd managed by RKE2, root ownership expected"
reviewed_by: "security-team"
date: "2026-03-15"
- control: "4.2.6"
reason: "ProtectKernelDefaults disabled for GPU driver compatibility"
reviewed_by: "security-team"
date: "2026-03-15"

What are the alternatives to kube-bench?

These tools do not exclude each other: they act at different moments. Checkov analyses your manifests before deployment, kube-bench and Kubescape audit the cluster once deployed, and Trivy also covers images. If you are preparing for the CKS, stay with kube-bench: the exam curriculum asks you to use the CIS benchmark, and kube-bench is the tool in this list that is dedicated to it.

ToolAdvantagesDrawbacks
kube-benchDedicated to CIS, simple to run, open sourceCIS Benchmark only
KubescapeMulti-framework (CIS, NSA, MITRE)More complex
CheckovMulti-cloud, IaCIaC focus, less K8s runtime
TrivyVersatile scannerCIS = one part of the features

Best practices

The classic trap of the CIS Benchmark is the one-time audit: you fix everything once, archive the report, and six months later the cluster has drifted without anyone knowing. The five points below aim to turn the audit into a recurring measurement. The fifth is the least intuitive: kube-bench picks its profile according to the detected Kubernetes version, so a cluster that is upgraded without updating kube-bench can end up evaluated with an outdated profile.

  1. Schedule audits by running kube-bench at least every month, ideally on every configuration change.
  2. Prioritize fixes by starting with the Level 1 FAIL controls.
  3. Document every exception, because some controls do not apply to your context.
  4. Automate the audit by building kube-bench into your CI/CD.
  5. Update kube-bench at the same time as Kubernetes.

CKS certification tips

What the exam expects comes down to three gestures: run kube-bench on the right node, read the report while distinguishing FAIL from WARN, then apply the remediation while adapting it to the real paths of the cluster.

What does the exam expect?

The CKS exam is hands-on and timed: you will not be asked to recite the structure of the benchmark, but to fix a cluster in a limited time. The five skills below detail the three gestures, in the order of a fix: run the tool, read the report, apply the remediation, run again to confirm. Practice mostly on the last two, editing the control plane manifests and the kubelet file: they are what costs time when you hesitate over the path.

  1. Run kube-bench and identify the failing controls
  2. Interpret the results: understand PASS, FAIL, WARN
  3. Apply the remediations suggested by kube-bench
  4. Edit the control plane manifests (/etc/kubernetes/manifests/)
  5. Configure the kubelet (/var/lib/kubelet/config.yaml)

Which commands should you know?

Four invocations cover most exam situations. The third, --check, is the one that saves the most time: after a fix, it replays a single control instead of the full scan. It accepts a comma-separated list.

Terminal window
# Scan the control plane components (section 1)
kube-bench run --targets master
# Scan the workers only
kube-bench run --targets node
# Filter on a specific control
kube-bench run --check 1.1.1
# Export to JSON for analysis
kube-bench run --json | jq '.Controls[].results[] | select(.status=="FAIL")'

Which mistakes should you avoid?

These three mistakes have one thing in common: none of them produces a clear message. Without sudo, kube-bench does not crash, it reports failures on files it could not read. With the wrong target, it returns a perfectly valid report, but for a different section than the one requested. Always check that the report covers what you think you asked for before concluding.

  • Forgetting sudo: kube-bench needs root permissions to read system files.
  • Mixing up the targets: master covers section 1 (control plane components), controlplane section 3 (authentication and audit). Both exist, they are not synonyms.
  • Not restarting the kubelet: after editing /var/lib/kubelet/config.yaml, run sudo systemctl restart kubelet.

Key takeaways

  • The CIS Kubernetes Benchmark is a reference of recommendations; kube-bench checks the configuration of a node, it scans neither images nor the runtime
  • The scan runs on the node it evaluates: master covers section 1 of the benchmark, controlplane section 3
  • A FAIL is a measured gap to fix first; a WARN is a control to rule on and document, never to ignore in a score
  • Hardening the control plane goes through the static Pod manifests: --profiling=false on the three components, and no --anonymous-auth=false on a kubeadm cluster
  • Without --exit-code 1, the audit job succeeds even with failing controls
  • The remediations in the report are generic: find the real path on your node
  • On managed clusters, the provider profiles mostly cover the nodes and the policies
  • CI/CD integration and the CronJob make the audit continuous

Knowledge check

Seven questions to check that the essentials are in place, in particular the targets trap: knowing which target to scan depending on the component, and not mixing up master with controlplane.

Knowledge check

Check what you have learned with this interactive quiz

7 questions
8 min
70% to pass

How it works

  • The timer starts when you click Start
  • Multiple choice, true/false and short answer questions
  • You can move between questions
  • Detailed results are shown at the end

Starts the quiz and the timer

Hands-on practice

A hardening is measured by a second audit, not by an intention. The first lab closes the Go profiler of the API server and raises the TLS floor, then demands both halves of the proof: the profiler answers 404 and the cluster still works. The second runs kube-bench on a kubeadm cluster fresh out of the installation, fixes the three controls that share one cause, and counts again.