Share via

how to manage and remove unused or vulnerable container images for Windows workloads

Manojkumar Periyannan (INFOSYS LIMITED) 40 Reputation points Microsoft External Staff
2026-03-18T08:44:51.26+00:00

Since AKS Image Cleaner is not supported for Windows node pools, could you please guide us on how to manage and remove unused or vulnerable container images for Windows workloads?

Are there any recommended approaches or official scripts available for this?

Azure Kubernetes Service
Azure Kubernetes Service

An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.

0 comments No comments

Answer accepted by question author
  1. Himanshu Shekhar 5,225 Reputation points Microsoft External Staff Moderator
    2026-03-26T15:39:48.8066667+00:00

    As per current AKS capabilities, the Image Cleaner feature is supported only for Linux node pools and is not supported for Windows node pools at this time.

    The primary reason for this limitation is that Trivy OSS, which is used as the underlying scanner for Image Cleaner, does not support Windows containers. As a result, there is currently no viable open-source scanner available for Windows container images that can be integrated into Image Cleaner workflows.

     For ongoing visibility into image health and vulnerabilities, Microsoft Defender for Containers provides vulnerability assessment capabilities across:

    • CI/CD pipelines
    • Container registries (such as ACR)
    • Runtime environments (AKS clusters)

    Defender enables continuous assessment of container images and workloads, helping teams periodically review the image versions currently in use and identify known vulnerabilities.

    Refer to the official documentation for a complete overview and supporting details: https://learn.microsoft.com/en-us/azure/defender-for-cloud/defender-for-containers-azure-overview?__prettifying=true

     Automatic update of image references to approved or latest builds - For automating image updates, the Flux v2 extension supports image update automations, allowing Kubernetes workloads to automatically track and deploy approved or latest container image versions based on defined policies.

    This approach helps ensure that deployments stay aligned with validated image versions without manual intervention.

    Documentation: https://fluxcd.io/flux/components/image/imageupdateautomations/

     Enforcement mechanisms to prevent the use of outdated or vulnerable images

    Microsoft Defender for Containers provides gated deployment capabilities, allowing enforcement of security policies during workload deployment.

    Using vulnerability metadata, Defender can:

    • Audit deployments that use vulnerable images
    • Deny deployments based on severity thresholds or policy rules
    • This ensures that outdated or non-compliant images are prevented from running in the cluster.

    Documentation: https://fluxcd.io/flux/components/image/imageupdateautomations/

    Validation that all workloads are running approved and up-to-date images

    When Defender for Containers is enabled, customers can centrally monitor:

    • All container images running across Defender-enabled subscriptions and AKS clusters Associated vulnerability findings for each workload
    • This provides a single view to validate whether workloads are running on the most recent approved images and to identify components that require remediation
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Himanshu Shekhar 5,225 Reputation points Microsoft External Staff Moderator
    2026-03-18T09:15:39.8266667+00:00

    Manojkumar Periyannan (INFOSYS LIMITED) - There is no supported automatic image‑cleanup solution for Windows node pools today; the supported path is regular node pool upgrades/reimages and staying on supported Windows LTSC node images, while Image Cleaner remains Linux‑only

    Node images in Azure Kubernetes Service (AKS) - https://docs.azure.cn/en-us/aks/node-images

    Use Image Cleaner to clean up vulnerable stale images on your Azure Kubernetes Service (AKS) cluster - https://learn.microsoft.com/en-us/azure/aks/image-cleaner

    Supported and recommended options today are:

    1. Regular node pool upgrades or reimaging: Reimaging or upgrading Windows node pools is the supported way to remove accumulated container images and apply the latest security patches to the underlying OS. - https://learn.microsoft.com/en-us/azure/aks/windows-best-practices
    2. Stay on supported Windows LTSC node images: Ensuring your Windows node pools run supported LTSC versions helps reduce exposure to known vulnerabilities, even though it does not selectively delete unused images.
    3. Rely on kubelet’s built‑in image garbage collection and this runs automatically under disk pressure on Windows nodes but is reactive and not vulnerability‑aware.

    As a next step, we kindly request you to try the below recommendation and let us know the outcome.

    We suggest using Kubernetes Garbage Collection to automatically manage and clean up unused container images and related resources. This is a standard and recommended approach within Kubernetes. You can find the official documentation here for reference: https://kubernetes.io/docs/concepts/architecture/garbage-collection/?__prettifying=true

    0 comments No comments

  2. Q&A Assist
    2026-03-18T08:45:08.21+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    For AKS Windows node pools there is no built‑in equivalent to AKS Image Cleaner, and Image Cleaner explicitly does not support Windows node pools. There are also no official AKS scripts in the provided material that automate image cleanup specifically for Windows containers on AKS.

    Given the constraints in the context, the supported guidance for Windows workloads on AKS focuses on:

    1. Keeping node images current
      • Older node images can contain unpatched security vulnerabilities and might not work properly with new features. The recommendation is to keep AKS node images current and enable automatic upgrades so that the underlying Windows OS images receive security fixes.
      • This reduces the attack surface from OS‑level vulnerabilities, even though it does not directly prune unused container images.
    2. Using supported Windows OS versions
      • For Windows containers on AKS, the guidance is to use supported LTSC versions (for example, Windows Server 2022, and Windows Server 2025 preview) and to migrate away from retiring versions such as Windows Server 2019 and Windows Server 2022 as per the published retirement timelines.
      • Staying on supported Windows OS versions ensures that base images and host OS receive security updates, which is critical for mitigating vulnerabilities in Windows container workloads.
    3. Understanding current limitations
      • Image Cleaner does not support Windows node pools or AKS virtual nodes.
      • Defender for Cloud’s agentless vulnerability assessment for images and containers also cannot scan container images from nodes using Windows nodes.

    Within the provided context there is no documented, Microsoft‑published script or feature that:

    • Enumerates and prunes unused Windows container images on AKS nodes, or
    • Performs automated cleanup of vulnerable Windows container images on AKS.

    Operationally, for Windows workloads on AKS, the supported posture from the given material is therefore:

    • Use supported Windows LTSC node images and keep them updated/auto‑upgraded.
    • Plan migrations away from retiring Windows node OS versions according to the published dates.
    • Accept that Image Cleaner and the agentless image‑level vulnerability scanning do not currently apply to Windows nodes, and manage image hygiene using custom processes outside what is documented here.

    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.