Kube-bench is an open-source tool designed to perform security benchmarking and auditing of Kubernetes clusters. It checks your cluster configuration against the CIS Kubernetes Benchmark, a set of security best practices developed by the Center for Internet Security (CIS).
Kube-bench is primarily a command-line tool, but it also provides the ability to run checks using a Docker container. Here are some illustrative examples:
1. **Running Kube-bench on a Master Node:**
```bash kube-bench –version 1.23 ```
This command runs the CIS Kubernetes Benchmark checks for version 1.23 on the master node of your cluster.
2. **Running Kube-bench on a Worker Node:**
```bash kube-bench –version 1.23 –node ```
This command runs the CIS Kubernetes Benchmark checks for version 1.23 specifically for worker nodes.
3. **Running Kube-bench using Docker:**
```bash docker run –rm -v /etc:/host/etc:ro \
-v $(which kubectl):/usr/local/mount-from-host/bin/kubectl:ro \ aquasec/kube-bench:latest --version 1.23```
This command runs Kube-bench within a Docker container, mounting the necessary host directories to access configuration files and the `kubectl` binary.