Hardening with CIS Benchmarks - Running kube-bench Jobs
Introduction to CIS Benchmarks
The Center for Internet Security (CIS) provides best practices for securing Kubernetes. In this lab, we will use kube-bench, an open-source tool from Aqua Security, to check whether our cluster meets these security recommendations.
Running kube-bench as a Job
In a CKS exam or production environment, you often run kube-bench as a Kubernetes Job to scan nodes without SSH access.
Instead of creating your own job manifest, use the official job configuration from Aqua Security: job.yaml
Run kube-bench on specific nodes
- Create configurations to run kube-bench on both master and worker nodes
use nodeSelector and tolerations.
Manual Security Baseline Assessment
Objective: Establish a security baseline and understand current cluster posture.
Create namespace kube-bench and run above job inside it.
Check Secrets encryption
Objective: Understand how secrets are stored and verify encryption status.
Create test secrets for security analysis
Examine secret storage in etcd (Advanced CKS skill)
Note
Understanding the output: The data shows Kubernetes protobuf format with secret metadata, but you can see plaintext values embedded in the binary data. Look for admin in the output.
Decode secrets to see plaintext content
Use base64 -d to decode unencrypted secrets.
Warning
Critical Security Insight: without encryption at rest, Secrets are stored in etcd as plaintext. This means anyone with filesystem access to the etcd backups or direct access to the etcd API can bypass Kubernetes security entirely to read your sensitive data.
However, enabling encryption at rest only protects the data “on disk.” When a user retrieves a Secret via kubectl or the API, the API server automatically decrypts it. To prevent unauthorized users from viewing these values, you must implement strict Role-Based Access Control (RBAC) to limit who can get or list Secret resources.
Check current security status
Next: Continue with Hardening with CIS Benchmarks - Remediations to learn how to fix the security issues found by kube-bench.