A privileged container and a vulnerable package are different risks. One comes from the workload specification; the other comes from software inside the image. They need different evidence, owners, and fixes.
A useful Kubernetes security audit separates configuration, permissions, runtime health, and image findings before assigning severity. Start with what the Kubernetes API can prove. Add Trivy when you need image, misconfiguration, or secret scanning. Then trace every finding back to the workload that can actually be changed.
TL;DR
- Confirm the Kubernetes context and scope of the audit.
- Triage workload configuration: privilege, host namespaces, root execution, capability and filesystem settings.
- Inspect requests, limits, node pressure, and service account use separately from security controls.
- Trace broad RBAC rules to the subjects and workloads that receive them.
- Use Trivy for image vulnerabilities and its additional Kubernetes scanners.
- Deduplicate findings by workload and image before prioritizing remediation.
- Verify the proposed YAML or image change, then rescan.
Do not sort one mixed list by Critical and assume the first row is the most exploitable issue in your environment.
What can Kubernetes configuration tell you without a vulnerability scanner?
The live API already exposes high-value security evidence:
securityContext.privileged- host PID, network, and IPC namespace sharing
runAsNonRootand user IDsallowPrivilegeEscalation- added and dropped Linux capabilities
- read-only root filesystem configuration
- service account and token mounting
- Role and ClusterRole rules
- RoleBinding and ClusterRoleBinding subjects
- mutable image tags and digest pinning
- CPU and memory requests and limits
- node pressure and readiness conditions
These checks are deterministic. You can point to the exact field that produced the finding and review the proposed patch before applying it.
The Kubernetes Pod Security Standards provide a useful baseline for workload controls, but an audit finding is not the same as admission enforcement. A cluster may allow a setting that your team still wants to remediate.
Why should RBAC be a separate investigation?
RBAC risk depends on who receives a permission and where it applies. A wildcard rule in an unused test namespace is not the same operational risk as a cluster-wide binding used by a production controller.
For each broad rule, answer:
- Is it a Role or ClusterRole?
- Which binding grants it?
- Which users, groups, or service accounts are subjects?
- Which workloads use those service accounts?
- Are sensitive resources such as Secrets included?
- Is the permission required by the workload’s observed behavior?
The RBAC delete permission guide shows how to verify an effective permission instead of inferring access from role names.
Do not “fix” a broad ClusterRole by editing it before you know every binding that consumes it. A narrower replacement may need to be introduced first.
What does Trivy add?
Trivy can scan Kubernetes targets for vulnerabilities, misconfigurations, and exposed secrets. It can also scan individual images in more detail.
That adds evidence the Kubernetes object alone cannot provide:
- vulnerable operating-system or application packages
- installed and fixed package versions
- vulnerability identifiers and advisory links
- image-level findings shared by many workloads
- additional configuration and secret checks from Trivy scanners
Keep the source visible. “Krust built-in rule” and “Trivy CVE result” should not look like the same kind of finding.
In Krust, the built-in audit engine evaluates cached Kubernetes resource state. Optional Trivy integration runs the locally installed trivy executable and parses its JSON output into the same audit workspace. Install it separately on the Mac:
brew install trivy
trivy --version
Krust Settings → Security shows whether Trivy is available and lets you choose cluster or per-image scanning, severity filters, scanners, timeouts, and namespace scope.
How should you prioritize mixed findings?
Use four dimensions, not severity alone:
| Dimension | Question |
|---|---|
| Reachability | Can an attacker or untrusted workload reach the affected surface? |
| Privilege | What identity, host access, capability, or secret access does it provide? |
| Exploitability | Is the vulnerable code present, reachable, and applicable to this deployment? |
| Blast radius | How many workloads, namespaces, clusters, or images share the condition? |
A critical CVE in an unused package may be less urgent than a high-severity privilege-escalation path on an internet-facing workload. Conversely, one vulnerable base image can affect dozens of Deployments and deserves an image-level fix rather than many workload patches.
Group by remediation owner:
- Workload YAML: security context, capabilities, token mount, resources.
- Platform/RBAC: roles, bindings, admission, namespace policy.
- Image pipeline: base image and package upgrades.
- Cluster operations: node conditions and unsupported components.
A practical audit workflow in Krust
1. Fix the scope
Select the intended context and namespace before scanning. Record whether the result is cluster-wide, namespace-scoped, or image-specific.
2. Run built-in checks first
The built-in audit is fast because it reads the resource state Krust already keeps warm. Filter by category and open the affected object. Verify the field that produced each finding.
3. Add Trivy evidence
Use cluster scan when you need broad coverage. Use image scan when one deployed image needs package-level detail. If the scan fails, treat the execution error as an error—not as a clean result.
4. Trace the owner
A Pod is often disposable. Follow it to the Deployment, StatefulSet, DaemonSet, Job, or CronJob that owns the template. Remediate the controller or source manifest so the next Pod does not recreate the finding.
5. Review the diff
Open the YAML and compare the proposed change. For GitOps-managed resources, make the durable change in Git. Use Krust YAML and diff to inspect live state and revisions without treating a tactical patch as the source of truth.
6. Rescan and verify
Confirm the old Pods are replaced, the expected image digest is running, RBAC access changed as intended, and the finding no longer appears. Security remediation is incomplete until the deployed state changes.
Common wrong moves
- Mixing policy and CVE findings without source labels: they have different evidence and fixes.
- Treating scanner failure as zero findings: absence of output is not a clean scan.
- Patching a Pod directly: its controller will recreate the old specification.
- Removing permissions before tracing bindings: shared roles can break unrelated workloads.
- Upgrading a package only on a running container: the image pipeline remains vulnerable.
- Claiming a fixed version means the workload is fixed: verify the new digest is deployed.
FAQ
Does Krust bundle Trivy?
No. Krust detects and runs a locally installed Trivy executable. The built-in Kubernetes configuration audit works separately.
Is a Kubernetes security audit the same as Pod Security Admission?
No. An audit reports observed conditions. Admission can enforce policy when workloads are created or updated. Use audit findings to design and verify enforcement rather than treating the two as interchangeable.
Should every vulnerability block a deployment?
Severity is one input. Teams normally combine it with exploitability, reachability, available fixes, workload exposure, and policy. Keep those decisions explicit in the image pipeline.
