OnCallReadyStart learning

kube-linter: lint Kubernetes YAML and Helm charts against security and production-readiness checks (StackRox kube-linter 0.8)

kube-linter lint [flags] PATH...

What it does

Runs the default checks on every object in the files or directories given: latest-tag, no-read-only-root-fs, run-as-non-root, privileged-container, privilege-escalation-container, host-network / host-pid / host-ipc, sensitive-host-mounts, docker-sock, env-var-secret, drop-net-raw-capability, unset-cpu-requirements, unset-memory-requirements, no-anti-affinity, mismatching-selector, dangling-service, non-existent-service-account. One line per finding with the check name and its remediation; any finding exits 1.

Options you will use

--format plain|json|sarif
Output format (default plain).
--include LIST
Add these checks to the defaults.
--exclude LIST
Skip these checks.
--do-not-auto-add-defaults
Run only the checks given with --include.
--add-all-built-in
Run every built-in check.

Examples

$ kube-linter lint deploy.yaml

the findings, then "Error: found N lint errors"

$ kube-linter lint manifests/ --exclude no-anti-affinity

a whole directory, without one check

$ kube-linter version

Gotchas

Taught in

On the blog

Try kube-linter in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.