← All posts

Build walkthrough · Security & Patching

Patching Kubernetes and Container Images: Nodes, Base Images and Helm

How to keep clusters, node images, base images and Helm charts patched, using scanners like Trivy and Grype and the Kubernetes support window.

Asaasin EngineeringPublished November 17, 202611 min read

In short

Kubernetes patching is not one task, it is five: the control plane and its minor version, the node OS image, the container base image, the application's own dependencies, and the Helm chart that wires all of it together. Each layer has its own patch cadence and its own failure mode. Patch them as a single blob and something always falls through a gap nobody owns.

The five layers, and who owns each one

Treat these as five separate patching jobs with five separate clocks, even when one team runs all of them.

Control plane and minor version. This is the Kubernetes version itself (API server, controller manager, scheduler, etcd) plus kubelet on every node. It moves on a release calendar set by the upstream project, not by your sprint schedule.

Node OS image. The operating system under the kubelet, whether that is a managed node group AMI, a Bottlerocket or Flatcar image, or a hand-rolled Ubuntu build. This patches independently of Kubernetes itself and usually lags behind a cloud provider's own release notes.

Base image. The FROM line in every Dockerfile. A base image carries its own OS packages and runtime libraries, and a stale base image is the single most common source of container CVEs, regardless of how current the application code is.

Application dependencies. The npm packages, Python wheels, or Go modules your code actually imports. These move on their own upstream cadence and need the same dependency-patching discipline described in our walkthrough on SBOMs and dependency patching.

Helm charts. The chart pins versions for the application image, its sidecars, and any bundled dependencies like an ingress controller or a cert manager. A chart that is not bumped keeps deploying an old image even after you have patched everything upstream of it.

Miss any one of these and a scanner will eventually find it, usually at the worst time.

The Kubernetes support window is the real clock you are patching against

Kubernetes maintains release branches for the three most recent minor versions only, and a given minor version receives roughly 14 months of support in total: about 12 months of regular patch releases, followed by about 2 months of maintenance mode where fixes are limited to CVEs, dependency or base-image updates, and critical core issues, before the branch reaches end of life (Kubernetes patch releases and support period). Patch releases inside that window are typically monthly, with out-of-band releases issued when a fix cannot wait (Kubernetes patch releases and support period).

That 14-month window is the actual driver of your upgrade cadence, not internal planning preference. If you sit on a minor version through its full support life without a plan to move, you run out the clock into an unsupported branch with no vendor to call. We cover what happens next in end-of-life software risk.

The second constraint is version skew. Kubernetes' version skew policy caps how far components are allowed to drift from one another, most visibly between kubelet and the API server (Kubernetes version skew policy). That limit means you cannot let node pools sit multiple minors behind the control plane indefinitely while you get around to upgrading them. The skew policy effectively sets a floor on how often node upgrades have to track control plane upgrades, which is why a clean patching cadence treats control plane and node pool version as a paired upgrade rather than two independent projects.

Put together, the support window and the skew policy mean a Kubernetes patching program has to run on upstream's calendar in two dimensions: how long you can stay on a given minor, and how far nodes can lag the plane while you move.

Why rebuilding beats patching a container that is already running

A container image is a filesystem snapshot. Patching inside a running container (shelling in and running an OS package manager) changes that one container instance and nothing else. The image in the registry is unchanged, the next pod scheduled from that image reverts to the old, vulnerable state, and the fix you just applied by hand disappears the moment the pod restarts, autoscales, or gets rescheduled to a different node.

Rebuilding the image is the only fix that survives a restart. You patch the Dockerfile's base image reference, rebuild, rescan, push a new tag, and let Kubernetes' own rolling update replace every running pod with the patched version. The fix becomes the new baseline instead of a one-off exception that drifts out of sync the next time the scheduler moves a pod. This is the same reasoning behind immutable infrastructure generally: you do not edit a live instance, you replace it with a new one built from a known-good definition.

The practical result is that "patch the container" and "patch the image" are different operations with different guarantees, and only the second one is durable.

An image rebuild pipeline that scans and redeploys

The shape below is deliberately simple: a base-image or dependency update triggers a rebuild, a scanner (Trivy or Grype, both of which we work with) gates the push, and a passing image flows into the chart and the cluster. A failing image stops at the gate and never reaches a node.

Trigger base image bump or dependency update Rebuild image docker build, new content-addressed tag Scan gate Trivy or Grype, fail on severity floor Gate fails build stops, no push Gate passes push to registry Bump Helm chart image.tag value helm upgrade rolling deploy Old pods drain new pods pass readiness Rescan deployed confirm clean image live

A minimal CI shape for the scan gate, using Grype against a freshly built tag before it is ever allowed near a cluster:

name: rebuild-and-gate
on:
  schedule:
    - cron: "0 3 * * *"
  push:
    paths:
      - "Dockerfile"
      - "requirements.txt"

jobs:
  build-scan-push:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Build image
        run: docker build -t registry.internal/app:${{ github.sha }} .

      - name: Scan with Grype
        uses: anchore/scan-action@v3
        with:
          image: "registry.internal/app:${{ github.sha }}"
          fail-build: true
          severity-cutoff: high

      - name: Push patched image
        if: success()
        run: docker push registry.internal/app:${{ github.sha }}

      - name: Bump Helm chart and deploy
        if: success()
        run: |
          helm upgrade app ./charts/app \
            --set image.tag=${{ github.sha }} \
            --atomic --timeout 5m

The gate step is the whole point. fail-build: true means a scan finding at or above the configured severity stops the pipeline before the image reaches the registry, let alone a node. --atomic on the Helm upgrade rolls the release back automatically if the new pods fail readiness, so a bad rebuild does not strand the cluster mid-rollout.

A short Python script illustrates the same gate logic for a team wiring Trivy into a custom pipeline rather than a vendor action:

import json
import subprocess
import sys

SEVERITY_FLOOR = {"CRITICAL", "HIGH"}

def scan_image(image_tag: str) -> list[dict]:
    result = subprocess.run(
        ["trivy", "image", "--format", "json", "--quiet", image_tag],
        capture_output=True, text=True, check=True,
    )
    report = json.loads(result.stdout)
    findings = []
    for target in report.get("Results", []):
        for vuln in target.get("Vulnerabilities", []) or []:
            if vuln["Severity"] in SEVERITY_FLOOR:
                findings.append(vuln)
    return findings

def main(image_tag: str) -> None:
    findings = scan_image(image_tag)
    if findings:
        for v in findings:
            print(f"BLOCKED: {v['VulnerabilityID']} ({v['Severity']}) in {v['PkgName']}")
        sys.exit(1)
    print(f"Clean: {image_tag} has no high/critical findings, safe to push")

if __name__ == "__main__":
    main(sys.argv[1])

Either shape does the same job: rebuild, scan, gate, push, redeploy. Nothing reaches a node until the scan passes.

Node images and Helm charts need the same rigor, on their own schedule

Node OS patching is a separate rebuild loop from application images, but the mechanics rhyme. A managed node group rotates to a newer AMI or node image, then nodes drain and get replaced the same way old pods do, one at a time, with workloads rescheduled onto already-patched nodes before the old ones are removed. On AWS this runs through node group rotation and Systems Manager, which we cover in more detail in patch management on AWS. The node image clock should be reviewed against the control plane upgrade schedule, because of the version skew limits noted above, not run as an independent, whenever-convenient task.

Helm charts are the layer teams forget most often because a chart that is never touched keeps deploying a frozen image tag even after the registry has a patched one sitting right next to it. A chart review should check three things on a cadence: the application image tag matches the latest scanned-clean build, any bundled sub-charts (an ingress controller, a cert manager, a database operator) are pinned to current patched versions rather than latest, and chart values that set resource limits or security contexts have not drifted from the hardened baseline. Treat a chart bump as part of the same pipeline as the image rebuild, not a separate manual step someone remembers to do later.

What to do when a scan finds something critical in production

This is where the layers above stop being a maintenance checklist and become an incident. A scanner finding a critical-severity vulnerability in an image already running in production needs a different track than the routine rebuild cadence: emergency rebuild and redeploy if a patched upstream version exists, or a stopgap such as a network policy change or a WAF rule in front of the affected service if it does not, a pattern we cover in virtual patching with a WAF or IPS rule.

Our vulnerability patching services run exactly this split: an ongoing program that inventories dependencies, scans continuously, and prioritizes by CVSS plus active-exploit signals like the CISA KEV list, alongside an urgent-response lane for exactly this scenario. The published response targets for the urgent lane, measured from when an issue is reported or found by scanning, and stated as targets rather than contractual guarantees: critical findings acknowledged within 15 minutes, an engineer engaged within 1 hour, and mitigation within 24 hours; high-severity findings acknowledged within 4 hours and patched within 7 days; medium within 1 business day and patched within 30 days; low picked up in the next scheduled cycle, within 90 days. How those targets translate into a workable SLA for your own environment is covered in patch SLAs.

The engagement shape behind that is the same as the one described on how it works: an intro conversation, a baseline assessment of what is actually running and what is actually patched, a prioritized plan, then ongoing patching and reporting with the urgent lane sitting on call for exactly the critical-finding scenario above.

The short version

  • Patch five layers on five clocks: control plane/minor version, node OS image, container base image, application dependencies, and Helm charts.
  • The 14-month Kubernetes support window (roughly 12 months of patch releases plus 2 months of maintenance mode) and the version skew policy are what actually set your upgrade cadence, not internal preference.
  • Rebuild and redeploy, do not patch a running container. A patch applied to a live container disappears on the next restart because the image in the registry is unchanged.
  • Gate every rebuilt image with Trivy or Grype before it reaches a registry or a node, and bump the Helm chart's image tag in the same pipeline run.
  • A critical finding in a production image is an incident, not a maintenance task, and should route to an urgent response lane with its own response targets rather than waiting for the next scheduled patch cycle.

Frequently asked questions

How often should I upgrade my Kubernetes minor version?
Kubernetes supports only the three most recent minor versions, and each minor gets roughly 14 months total: about 12 months of regular patch releases followed by about 2 months of maintenance mode limited to CVE and critical fixes before end of life. Staying inside that window, rather than running it to the edge, keeps you eligible for the monthly patch releases and any out-of-band releases issued for urgent fixes.
Why not just patch the running container instead of rebuilding the image?
A running container is a snapshot taken from an image. Patching it in place changes only that one instance, and the fix disappears the moment the pod restarts, autoscales, or gets rescheduled, because the new pod is created from the old, unpatched image. Rebuilding the image and redeploying through Helm is the only way the fix survives the next restart.
What is the difference between patching a base image and patching application dependencies?
A base image carries the operating system packages and runtime underneath your application (the `FROM` line in a Dockerfile), while application dependencies are the packages your code actually imports, such as npm or pip packages. Both need independent scanning and patch cadences; a clean base image does not mean clean dependencies, and vice versa.
Does version skew between kubelet and the API server matter if I am not upgrading right now?
Yes. Kubernetes' version skew policy caps how far kubelet can drift behind the API server, so node pools cannot sit several minors behind the control plane indefinitely even if nothing appears broken. That cap is what forces node upgrades to track control plane upgrades on a regular schedule rather than whenever convenient.
Should Helm chart updates be part of the same pipeline as image rebuilds?
Yes. A chart that still points at an old image tag keeps deploying the unpatched version even after a clean, rescanned image exists in the registry. Bumping the chart's image tag and any pinned sub-chart versions should happen in the same pipeline run as the rebuild and scan, not as a separate manual step.

Sources

The team behind Asaasin Engineering

  • Blend Berisha

    Technical Lead / Engineering Lead

  • Doruntina Buzhala

    Business Development Manager

  • Erin Abduli

    Full-Stack Engineer

  • Florent Hoti

    Co-Founder & CEO

  • Gentrit Hoti

    Software Engineer

  • Hana Anadolli

    Operations Manager

  • Krenar Mahmuti

    AI Automations Specialist

Meet the team

Need patching or a critical response?

Tell us what you're running and what's going on. We'll get back to you.

What happens on the call
01You describe the outcome you need.
02We map it to scope, price, and a start date.
03You decide whether to proceed to a free prototype.
Schedule a 30-minute call