k8s-security-pro/k8s-audit

A fast, dependency-light Kubernetes security audit with kubectl and jq, mapped to the k8s-security.pro 50-point checklist.

4

stars

4

commits

Shell

primary language

Sep 6, 2026

updated

k8s-security.pro
cis-benchmark
cloud-native
devsecops
hardening
kubernetes
kubernetes-security
security
Browse cluster: Kubernetes Operators and Cloud-Native Infrastructure

README

k8s-audit

A fast, dependency-light Kubernetes security audit you can run in one command.

k8s-audit runs a set of high-signal security checks against your current cluster using only kubectl + jq, and prints a clean report grouped by security domain — privileged containers, missing NetworkPolicies, over-broad RBAC, :latest images, missing resource limits, and more.

It's read-only, sends nothing anywhere, and needs no install beyond a shell.

k8s-audit sample output — a colored terminal report grouped by security domain

Why this exists

Everything in Kubernetes security is technically "free" — CIS Benchmark, kube-bench, Kubescape, Trivy. But those tools flag hundreds of items and leave you to figure out which ones matter and how to fix them. k8s-audit is the opinionated 30-second first pass: ~16 checks that catch the most common real-world exposures, each mapped to a specific item in the k8s-security.pro 50-point checklist.

It's built and maintained by the team behind k8s-security.pro — a production hardening kit (50-point audit, 25 YAML templates, Helm chart, Kustomize overlays, CIS & SOC2 mappings). This repo is the free, open-source front door to it.

Install

No install required — just clone and run:

git clone https://github.com/k8s-security-pro/k8s-audit.git
cd k8s-audit
./k8s-audit.sh

Requirements: kubectl (pointed at your cluster) and jq.

Usage

./k8s-audit.sh                 # audit all namespaces
./k8s-audit.sh -n payments     # a single namespace
./k8s-audit.sh --json          # machine-readable output (for CI / dashboards)

Exit code is non-zero if any FAIL-severity check trips — so you can gate CI on it.

Use it in CI

Drop this into .github/workflows/k8s-security-audit.yml to fail a PR that introduces a privileged container or an unprotected namespace (full example in .github/workflows/):

- name: Kubernetes security audit
  run: |
    curl -sSL https://raw.githubusercontent.com/k8s-security-pro/k8s-audit/main/k8s-audit.sh -o k8s-audit.sh
    chmod +x k8s-audit.sh
    ./k8s-audit.sh

What it checks (16 of 50)

#DomainCheck
2Pod SecurityPrivileged containers
3Pod SecurityallowPrivilegeEscalation not disabled
4Pod SecurityRunning as root (runAsNonRoot unset)
4bPod SecurityreadOnlyRootFilesystem not set
5Pod SecurityhostNetwork / hostPID / hostIPC
6Pod SecurityServiceAccount token auto-mounted
7Pod SecurityCapabilities not dropped (ALL)
7bPod SecurityDangerous capabilities added (SYS_ADMIN, NET_ADMIN, …)
9Pod SecurityhostPath volumes mounted
8NetworkNamespaces without a NetworkPolicy (no default-deny)
14RBACcluster-admin bindings
15RBACWorkloads using the default ServiceAccount
16RBACRoles granting * verbs on * resources
20Cluster HardeningWorkloads in the default namespace
22Cluster HardeningContainers without resource limits
28Supply ChainImages using :latest or untagged

Going deeper

k8s-audit deliberately stops at the high-signal dozen. For the complete picture:

  • The full 50-point audit + copy-paste remediation YAML, Helm chart, Kustomize overlays, and CIS/SOC2 compliance mappings → k8s-security.pro
  • Deeper CIS/NSA scanning → kube-bench, Kubescape, Trivy (if these are on your PATH, k8s-audit points you at the right command).

Contributing

Issues and PRs welcome — especially new high-signal checks (keep them kubectl+jq only, read-only, and mapped to a checklist domain). New to the project? Look for the good first issue label — each one is a small, self-contained check with the jq filter sketched out for you. See CONTRIBUTING.md for how a check is structured.

License

MIT © k8s-security.pro

Contributors

k8s-security-pro/k8s-audit

A fast, dependency-light Kubernetes security audit with kubectl and jq, mapped to the k8s-security.pro 50-point checklist.

4

stars

4

commits

Shell

primary language

Sep 6, 2026

updated

k8s-security.pro
cis-benchmark
cloud-native
devsecops
hardening
kubernetes
kubernetes-security
security
Browse cluster: Kubernetes Operators and Cloud-Native Infrastructure

README

k8s-audit

A fast, dependency-light Kubernetes security audit you can run in one command.

k8s-audit runs a set of high-signal security checks against your current cluster using only kubectl + jq, and prints a clean report grouped by security domain — privileged containers, missing NetworkPolicies, over-broad RBAC, :latest images, missing resource limits, and more.

It's read-only, sends nothing anywhere, and needs no install beyond a shell.

k8s-audit sample output — a colored terminal report grouped by security domain

Why this exists

Everything in Kubernetes security is technically "free" — CIS Benchmark, kube-bench, Kubescape, Trivy. But those tools flag hundreds of items and leave you to figure out which ones matter and how to fix them. k8s-audit is the opinionated 30-second first pass: ~16 checks that catch the most common real-world exposures, each mapped to a specific item in the k8s-security.pro 50-point checklist.

It's built and maintained by the team behind k8s-security.pro — a production hardening kit (50-point audit, 25 YAML templates, Helm chart, Kustomize overlays, CIS & SOC2 mappings). This repo is the free, open-source front door to it.

Install

No install required — just clone and run:

git clone https://github.com/k8s-security-pro/k8s-audit.git
cd k8s-audit
./k8s-audit.sh

Requirements: kubectl (pointed at your cluster) and jq.

Usage

./k8s-audit.sh                 # audit all namespaces
./k8s-audit.sh -n payments     # a single namespace
./k8s-audit.sh --json          # machine-readable output (for CI / dashboards)

Exit code is non-zero if any FAIL-severity check trips — so you can gate CI on it.

Use it in CI

Drop this into .github/workflows/k8s-security-audit.yml to fail a PR that introduces a privileged container or an unprotected namespace (full example in .github/workflows/):

- name: Kubernetes security audit
  run: |
    curl -sSL https://raw.githubusercontent.com/k8s-security-pro/k8s-audit/main/k8s-audit.sh -o k8s-audit.sh
    chmod +x k8s-audit.sh
    ./k8s-audit.sh

What it checks (16 of 50)

#DomainCheck
2Pod SecurityPrivileged containers
3Pod SecurityallowPrivilegeEscalation not disabled
4Pod SecurityRunning as root (runAsNonRoot unset)
4bPod SecurityreadOnlyRootFilesystem not set
5Pod SecurityhostNetwork / hostPID / hostIPC
6Pod SecurityServiceAccount token auto-mounted
7Pod SecurityCapabilities not dropped (ALL)
7bPod SecurityDangerous capabilities added (SYS_ADMIN, NET_ADMIN, …)
9Pod SecurityhostPath volumes mounted
8NetworkNamespaces without a NetworkPolicy (no default-deny)
14RBACcluster-admin bindings
15RBACWorkloads using the default ServiceAccount
16RBACRoles granting * verbs on * resources
20Cluster HardeningWorkloads in the default namespace
22Cluster HardeningContainers without resource limits
28Supply ChainImages using :latest or untagged

Going deeper

k8s-audit deliberately stops at the high-signal dozen. For the complete picture:

  • The full 50-point audit + copy-paste remediation YAML, Helm chart, Kustomize overlays, and CIS/SOC2 compliance mappings → k8s-security.pro
  • Deeper CIS/NSA scanning → kube-bench, Kubescape, Trivy (if these are on your PATH, k8s-audit points you at the right command).

Contributing

Issues and PRs welcome — especially new high-signal checks (keep them kubectl+jq only, read-only, and mapped to a checklist domain). New to the project? Look for the good first issue label — each one is a small, self-contained check with the jq filter sketched out for you. See CONTRIBUTING.md for how a check is structured.

License

MIT © k8s-security.pro

Contributors

Languages

Shell

100.0%