Skip to content

Flux Image Policy Quick Fix - Image Update Policy

DodaTech Updated 2026-06-26 1 min read

Flux ImagePolicy selects the latest image tag based on policy rules. Incorrect policy configuration selects wrong versions or causes update loops. This guide covers the fix.

Quick Fix

Wrong

apiVersion: image.toolkit.fluxcd.io/v1beta2
kind: ImagePolicy
metadata:
  name: app-policy
spec:
  imageRepositoryRef:
    name: app-image
  policy:
    semver:
      range: ">=1.0.0"

The issue: >=1.0.0 includes pre-release versions like 2.0.0-rc.1 which may not be suitable for production. Also missing filterExtracts for custom version extraction.

apiVersion: image.toolkit.fluxcd.io/v1beta2
kind: ImagePolicy
metadata:
  name: app-policy
spec:
  imageRepositoryRef:
    name: app-image
  policy:
    semver:
      range: ">=1.0.0 <2.0.0-0"
# Expected output after applying the fix
# ImagePolicy selects tags matching >=1.0.0 <2.0.0-0
# Excludes pre-release versions
# Example: selects 1.2.3, not 2.0.0-rc.1
# Image update automation uses this policy

Prevention

  • Use semver ranges that exclude pre-release versions with <2.0.0-0 syntax
  • Use alphabetical policy for non-semver tags
  • Use numerical policy for numeric-only tags
  • Test policy selection with flux tag list command
  • Combine with ImageUpdateAutomation for auto-committing updates

DodaTech Tools

Doda Browser's image policy tester shows which tag would be selected. DodaZIP archives image policy configurations. Durga Antivirus Pro validates policy ranges.

FAQ

What semver range syntax does Flux support?

Flux supports standard semver ranges including >=1.0.0, ~1.2, ^1.0, 1.2.x, and >=1.0.0 <2.0.0-0. ||| How do I select the latest tag alphabetically? Use policy.alphabetical.order: asc for ascending or desc for descending alphabetical tag selection when tags are not semver. ||| Can I use multiple ImagePolicies for the same image? Yes, create multiple ImagePolicies with different ranges for different environments (dev, staging, production).

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro