Table of Contents
- Sample Pod Specification
- Scanning with Kubesec
- CLI
- Docker Image
- HTTP API
- Bash Wrapper for HTTP API
- Jenkins Pipeline Integration
- Improving Your Security Score
- References
Sample Pod Specification
Here’s a minimal Pod manifest that enables a read-only root filesystem:Scanning with Kubesec
You can scan your YAML definitions in three ways:1. CLI
Install thekubesec binary, then run:
Bash Wrapper for HTTP API
Create a shell function to simplify HTTP scans:Jenkins Pipeline Integration
Here’s a sampleJenkinsfile that builds a Docker image, pushes it, then runs parallel scans with Conftest and Kubesec:
kubesec-scan.sh
Adjust the threshold (
5 points) to match your team’s security policy.Improving Your Security Score
Based on the advice from Kubesec, let’s update our Deployment to include:- A dedicated service account
- AppArmor & Seccomp annotations
- CPU & memory limits
- Immutable root filesystem
- Non-root user execution