Hardening with CIS Benchmarks - Automation and Continuous Compliance
Author: Fabrice JAMMES (LinkedIn).
Objective
Run kube-bench every week with a CronJob, to detect when a security setting of the cluster changes.
Why is running kube-bench by hand not enough in production?
Prerequisites
The Jobs only read the files of the nodes: the lab works on the shared cluster, in a namespace of your own.
Exercise 1: a weekly scan
Create a CronJob kube-bench, which runs the scan of the control plane of the first lab every Sunday at 2 AM. Keep the last 3 successful Jobs.
Exercise 2: run it now
Do not wait for Sunday: start a Job from the CronJob, and display the summary of its report.
Exercise 3: detect a change
How would you be alerted when the number of failed checks increases?
Summary
- Running kube-bench Jobs: scan the nodes and read the report.
- Security remediations: fix failed checks in the static pod manifests, and check them with a new scan.
- Automation: run the scan regularly, and watch its results.