Trivy scans Kubernetes workloads for vulnerabilities

Trivy Operator scans container images and Kubernetes configurations in the cluster. Map findings to running workloads and verify fixes after rollout.

On Monday, a new API image passes the CI pipeline and goes into production. On Wednesday, the Linux distributor publishes a security update for a package in the base image. The service still runs the same image. To decide which deployments need an update, the platform team needs to know which container includes the affected package and which image version is running in the cluster.

Trivy Operator scans Kubernetes workload images for known vulnerabilities and checks supported resources for misconfigurations. It stores the results as Kubernetes resources in the cluster so teams can map findings to the affected workloads. ayedo offers Trivy as a managed app and runs the operator in Germany. Managed Trivy at ayedo · Trivy Operator

Two reports point to different fixes

A VulnerabilityReport records known vulnerabilities in the operating system packages and application dependencies of a container image. For a workload with multiple containers, the operator creates a separate report for each container. The API image might be up to date while its sidecar still includes an older package. In that case the fix belongs in the sidecar image. VulnerabilityReport in the Trivy documentation

A ConfigAuditReport evaluates the configuration of a Kubernetes resource. If a report shows that a container allows privilege escalation, the change belongs in the workload configuration. The team can set allowPrivilegeEscalation: false in the securityContext and check in staging that the container still works as intended. When secret scanning is enabled, the operator also produces ExposedSecretReport resources. Trivy in the ayedo Polycrate Hub · ConfigAuditReport

From an image finding to a verified rollout

For an API in the shop namespace, start with three queries:

kubectl -n shop get pods -l app=checkout-api \
  -o custom-columns='POD:.metadata.name,CONTAINER:.status.containerStatuses[*].name,IMAGE_ID:.status.containerStatuses[*].imageID'

kubectl -n shop get vulnerabilityreports.aquasecurity.github.io
kubectl -n shop get configauditreports.aquasecurity.github.io

The first query shows which images the running containers use. The other two list the reports in the namespace. For an image finding, check the container, the package, the installed version, and the available fixed version. For operating system packages, Trivy uses advisories from the relevant distributor. That matters when a distributor has backported a fix to an older package version. In that case, check the distribution advisory alongside the version published by the upstream project. How Trivy detects vulnerabilities

Prioritize the finding in the context of the service. Is the affected component reachable from outside? What does the package do? Is a patched base image available? Once an update is available, rebuild and roll out the image. For sign-off, check the image digest of the new Pods and the report for the new image. Together they show which version is running and how the scanner assessed it.

Investigate a missing report

If a report is missing, check whether the namespace is in scope, whether the scanner can pull the image from the registry, and whether the scan job completed successfully. Report age matters too. The operator can recreate expired vulnerability reports, allowing it to check unchanged images against updated vulnerability data. Shorter intervals add scan load. Start with a representative namespace where you can monitor scan duration and failures. Trivy Operator configuration

Run Trivy with ayedo

The ayedo Polycrate block installs Trivy Operator through the official Helm chart. The ayedo Software Delivery Platform also uses Harbor as a registry and for scanning registry images. The operator adds reports for workloads in the cluster. To block a rollout based on findings, configure a separate rule in the CI pipeline or an admission policy in the cluster. Trivy in the ayedo Polycrate Hub · Registry and scanning in the ayedo platform documentation

With Managed Trivy, ayedo runs the operator. Your team decides which workloads to scan, who reviews findings, and what to fix in the next rollout. Start with a service that uses a private registry image and work through the process from the first report to a verified fix.

Want to find vulnerabilities and misconfigurations in your Kubernetes workloads? Talk to us about Managed Trivy and where to start in your cluster.