Using Trivy to Secure Your UpCloud Workloads: A DevSecOps Guide for Modern Infrastructure

Posted on 4 June 2026

Securing Kubernetes environments goes beyond scanning container images. Today, it demands deep architectural visibility, aggressive automation, and continuous runtime monitoring. The scale of the risk is staggering. According to the 2022 Sysdig Cloud-Native Security and Usage Report, 54% of container images hosted on Docker Hub leak sensitive information, including hardcoded secrets and credentials, leading to unauthorized access, data breaches, and identity theft.

For senior engineers and DevSecOps architects, the challenge isn’t just stopping these threats but doing so without slowing development. Teams are shifting left in security by leveraging tools like Trivy to inspect containers, identify threats, and mitigate security risks before they manifest in production.

However, relying on it alone without understanding its limitations on cloud platforms like UpCloud will likely introduce blind spots in your workload. This brings us to a critical question: Can a single, open-source tool like Trivy serve as the foundational security scanner for an entire workload on UpCloud?

In this article, we will explore Trivy’s core features and critically evaluate its ability to secure your UpCloud environment, from initial infrastructure code through to live Kubernetes workloads.

Shifting left on Container Security: What is Trivy?

Trivy is an open-source vulnerability scanner for container images, file systems, and application dependencies developed by Aqua Security. It applies a shift-left philosophy, moving security testing and validation processes to the beginning of the software development lifecycle (SDLC) rather than waiting until deployment day.

Think of it as a versatile security lens that can be applied at multiple checkpoints in your delivery pipeline to identify and avoid security risks in your Kubernetes cluster.
While it built its reputation as a container image scanner, Trivy has evolved into a comprehensive multi-target tool. When integrated into a cloud pipeline, its multi-scanning capabilities simultaneously address the following:

  • Infrastructure as Code (IaC) Flaws: It reviews your infrastructure blueprints, flagging misconfigured Terraform manifests, such as public-facing MaxIOPS storage volumes or wide-open security groups that allow unrestricted SSH access.
  • Leaked Secrets: It scans codebases and container layers for hardcoded API keys, platform credentials, or private SSH keys before they are accidentally committed to a public Git repository.
  • Software Vulnerabilities: It analyzes both operating system packages (such as Alpine or Ubuntu base layers) and application-level language dependencies (such as npm, Go, Python, or Rust) to map known software vulnerabilities.
  • Kubernetes (K8S) Misconfigurations: It audits your raw K8S manifests, Helm charts, and live cluster workloads to identify and flag misconfigurations such as pods running as root, missing resource quotas, or overly permissive RBAC roles.

Why Modern Infrastructure Demands a Continuous Scanner

In traditional environments, organizations could afford to run quarterly vulnerability assessments against relatively static infrastructure. However, modern cloud infrastructure moves far too quickly for periodic security audits to remain effective.

Containers are rebuilt daily, Kubernetes workloads scale dynamically, Infrastructure-as-Code continuously modifies environments, and application dependencies evolve faster than most teams can track manually. This is structurally dangerous, especially for teams deploying workloads on high-performance cloud environments like UpCloud.

To keep up, organizations need continuous scanning capabilities that can evaluate infrastructure, workloads, and configurations automatically to ensure:

  • Automated Vulnerability Assessment: Manual audits remain valuable for architectural reviews and compliance exercises, but they do not scale to modern cloud environments. By the time a manual review is completed, the infrastructure being evaluated may already have changed. Continuous scanners such as Trivy address this challenge by transforming vulnerability assessment into a repeatable, deterministic process.
  • Continuous Security Monitoring: One of the most overlooked realities of cybersecurity is that secure software can become insecure without a single line of code changing. A Kubernetes workload that passed security validation during deployment may later become exposed due to emerging threats or evolving security standards. Continuous monitoring helps organizations account for this reality by continuously reassessing existing assets against newly discovered vulnerabilities.
  • Early Risk Identification & Severity Prioritization: Large cloud environments can generate thousands of vulnerability alerts, many of which have little practical impact on the organization’s actual risk profile. Without effective prioritization, engineers can easily become overwhelmed, leading to alert fatigue and delayed remediation of genuinely critical issues. Trivy helps teams prioritize vulnerabilities by severity and impact, allowing engineers to filter out background noise and focus on remediation efforts.

Integrating Trivy Into a DevSecOps Workflow

A security tool is only as effective as its integration strategy. One of the most common reasons security programs struggle is not because the tools lack capabilities, but because they are introduced too late in the software delivery process. Vulnerabilities discovered after deployment are inherently more expensive to fix than vulnerabilities caught during development, and vulnerabilities discovered during incidents are the most expensive of all. The challenge for DevSecOps teams is therefore not simply identifying security issues. It is identifying them at the earliest practical point in the delivery lifecycle.

Hence, a production-ready DevSecOps pipeline should utilize a layered defense strategy, deploying Trivy across three primary operational checkpoints:

Local Developer Velocity:

The ideal time to discover a vulnerability is before the code ever leaves a developer’s local machine. Integrating Trivy into pre-commit hooks enables developers to automatically scan infrastructure-as-code configurations, container definitions, and application dependencies before changes are committed to source control. This creates an early feedback loop that prevents many common issues from progressing further into the pipeline.

For instance, a developer provisioning resources on UpCloud through Terraform may accidentally introduce an overly permissive security rule or expose a service publicly. Detecting that issue locally takes seconds to resolve, but it will take longer after deployment. So a pre-commit config file like this comes in handy.

Example .pre-commit-config.yaml snippet

repos:
  - repo: https://github.com/aquasecurity/trivy
rev: v0.50.0 \# Use the latest stable version
hooks:
  - id: trivy-config
name: Trivy IaC & Manifest Scanner
args:
  - '--severity'
  - HIGH
  - CRITICAL
  - '--exit-code'
  - '1'

This integrates Trivy into your Git workflow so you cannot commit insecure infrastructure or Kubernetes manifests without Trivy checking them first.

The CI/CD Gate:

Not every issue can be caught on a developer’s machine, which is why the continuous integration pipeline serves as the next logical enforcement point. It ensures that workloads entering the cluster have already passed a baseline security review.

So when code is pushed to a remote repository, your CI/CD platform (GitHub Actions, GitLab CI, or Jenkins) serves as the final quality gate before resources are provisioned on UpCloud. By the time an image reaches production, engineers should already understand its vulnerability profile and dependency risks. Your CI script should have strategic exit codes and triage logic like this:

# Snippet for GitHub Actions / GitLab CI step
- name: Run Trivy vulnerability scanner
  run: |
    trivy image \
    --cache-dir .trivycache \
    --ignore-unfixed \
    --severity HIGH,CRITICAL \
    --exit-code 1 \
    upcloud-registry.com/finance-app:${{ github.sha }}

Continuous Cluster Auditing:

Kubernetes environments are dynamic systems. So even if a cluster were perfectly secure on deployment day, there is a likelihood of configuration drift occurring in production. Continuous auditing provides a mechanism for identifying security drift, surfacing misconfigurations, and maintaining awareness of newly disclosed vulnerabilities even after applications have entered production.

The Trivy Operator natively integrates with the Kubernetes control loop. Running directly inside a Kubernetes cluster transforms security scanning into a continuous auditing process. It automatically watches for workload state changes (like a new Pod deployment or a configuration update) and spins up ephemeral, lightweight background workers to scan the resource. The operator translates security findings directly into native Kubernetes Custom Resource Definitions (CRDs). This allows DevSecOps engineers to query the actual security posture of their live production environment using standard Kubernetes tooling like this:

# Audit the security vulnerabilities of all live applications in a specific namespace
kubectl get vulnerabilityreports \-n production

# Audit cluster compliance against CIS Benchmarks or NSA hardening guidelines
kubectl get clusterconfigauditreports

Common Pitfalls in Container Security Scanning to Avoid

Even with a powerful tool like Trivy, organizations can fall into common traps that reduce the effectiveness of their security program. When deploying automated scanners across your cloud infrastructure, here are some mistakes to watch out for:

  • The Zero-Vulnerability Fallacy: A clean scan does not automatically mean a secure application. Many teams spend significant time chasing low-risk or unfixable vulnerabilities simply to reduce the number of findings in a report. In contrast, effective vulnerability management is about reducing meaningful risk, not achieving a perfect scorecard.
  • Ignoring the Context: Not every critical vulnerability presents the same level of risk. In reality, a package containing a critical vulnerability may never be executed, exposed externally, or reachable during the application’s runtime. Hence, security findings should always be evaluated within the context of how the application is deployed, used, and exposed to potential attackers.
  • Pipeline Bloat: Shifting left does not mean triggering deep vulnerability checks on every minor update. Running full-image, dependency, IaC, and Kubernetes scans on every feature branch can significantly increase build times and frustrate developers without providing commensurate security benefits. It’s more ideal to run lightweight configuration audits on daily commits while reserving heavy image scans for main release branches.
  • The Silent Failure: A vulnerability scanner is only as effective as the intelligence it uses to identify threats. If Trivy’s vulnerability database is outdated, scans may report clean results while missing recently disclosed CVEs (Common Vulnerabilities and Exposures) and actively exploited vulnerabilities. Without regular database updates, organizations risk developing a false sense of security, leaving production environments blind to emerging threats.

The DevSecOps Verdict: Can You Rely Solely on Trivy?

Trivy has become one of the most widely adopted security tools in the DevSecOps ecosystem for its user-friendly interface, fast scanning, and broad compatibility. It is ideal for teams looking to embed security into their existing delivery workflows without introducing significant operational overhead. Its capabilities extend beyond deployment pipelines.

For many organizations running workloads on UpCloud, this combination of vulnerability management, infrastructure-as-code scanning, container security, Kubernetes posture assessment, and software supply chain visibility provides a strong security foundation.

Despite its extensive capabilities, relying solely on Trivy as your defense might expose your UpCloud infrastructure to significant security risks. It has two hard architectural limitations that it was simply never designed to solve.

  • Trivy does not monitor active workload behavior or detect threats in real time. Even with the Trivy Operator running inside a Kubernetes cluster, it remains a static scanning and vulnerability assessment tool. It cannot observe kernel-level runtime activity such as system calls, process anomalies, or network socket mutations.
  • Trivy also has zero visibility into your UpCloud Control Panel or global Identity and Access Management (IAM) configurations. It cannot tell you if an engineer has disabled Multi-Factor Authentication (MFA) or if an API token has been granted excessive platform privileges. These areas require separate controls and observability mechanisms beyond the scope of vulnerability scanning.

Architectural Recommendation:

The biggest mistake organizations make when adopting security tooling is expecting a single product to solve every security problem. While Trivy addresses a comprehensive list of security needs, it was intentionally designed as a preventive security tool rather than an all-in-one security platform. Therefore, DevSecOps teams should consider using Trivy as the foundation of a layered security architecture and pair it with the following:

Account-Level Tracking (UpCloud Audit Logs)

While Trivy ensures that your declarative Terraform manifests define a secure state, you must ensure that your live cloud environment doesn’t change behind your back. Pair Trivy with native UpCloud Audit Logs streamed to a centralized log management tool or SIEM (Security Information and Event Management). This ensures that Trivy flags whether a security group manifest is properly locked down, while your audit logs track whether someone manually altered that firewall rule directly inside the live UpCloud console.

Kernel/eBPF-Level Runtime Monitoring

For production workloads running on UpCloud Kubernetes Service (UKS), runtime monitoring should also be considered. By leveraging eBPF technology directly inside the Linux kernel of your worker nodes, you gain real-time visibility into system behavior. While Trivy ensures your base container images are clean before deployment, eBPF monitors the live environment. This ensures instant alerting or blocking of workloads if a shell is suddenly spawned inside a production pod or if an unapproved binary attempts to overwrite a system file.
Together, these layers create a far more resilient security model than any individual tool can provide.

Wrapping Up

Security in modern cloud-native systems is no longer about finding the right tool but about building a layered, effective defense strategy. Trivy stands out because it consolidates multiple security concerns into a single, developer-friendly workflow. For teams running workloads on UpCloud or operating Kubernetes through UpCloud Kubernetes Service, that comprehensiveness alone is an effective step toward reducing operational security debt.

The decision framework for using Trivy in your cloud workloads depends on whether It provides sufficient coverage to serve as the security foundation on which additional controls can be layered.

Hence, if an organization relies on manual reviews, periodic audits, or fragmented scanning tools, Trivy represents a significant improvement and will likely address most preventive security needs. On the contrary, if an organization operates regulated workloads, manages sensitive customer data, or runs large-scale production systems, Trivy should be viewed as one layer within a broader security architecture.

Try out today!

Start your free 14-day trial today and discover why thousands of businesses trust UpCloud

  • Risk-free trial
  • Optimized performance
  • Scalable infrastructure
  • Top-tier security
  • Global availability

Sign up

See also

Post about how Kubernetes is changing the DevOps space.

How Kubernetes is changing the DevOps space

In this post, we will look at why you should create cluster computing using Kubernetes and UpCloud.

Janne Ruostemaa

Editor-in-Chief

Kubernetes is big in Finland! Join us at the October meetup.

Kubernetes is big in Finland! Join us at the October meetup

A new meetup initiative Kubernetes Finland is on a mission to boost Kubernetes and Cloud Native Computing Foundation tech adoption in Finland.

Janne Ruostemaa

Editor-in-Chief

Sini Luukkanen, Senior HR Manager, quoted: 'Tailored company benefits make employees feel cared for'.

Sini Luukkanen: Tailored company benefits make employees feel cared for

Well-being, joy, and work-life balance are highly valued at UpCloud. People who feel good at work create a great company such as ours. That’s why […]

Barbora Mervaala

Social Media and Content Specialist at UpCloud. Passionate about writing stories about inspiring people and companies.

Back to top