Course contentsShow
← Cloud and Infrastructure
Lesson 1929 of 2,98941. FluxFree lesson

Image Automation with Flux

Automate container image updates using image-reflector-controller and image-automation-controller to update Git.

Image Automation with Flux

What You'll Learn

You'll learn how to automatically update container images in your Git repository whenever new versions are published, using Flux's image-reflector-controller and image-automation-controller.

The Core Idea

In GitOps, your Git repository is the single source of truth. But what happens when a new container image version is built? Manually updating image tags in Git defeats the purpose of automation.

Flux solves this with two controllers working in tandem:

  • image-reflector-controller: Scans container registries (like Docker Hub, ECR, or GCR) for new image versions based on policies you define
  • image-automation-controller: Automatically commits updated image tags back to your Git repository

Think of it like a watchdog that monitors your container registry and a clerk that updates your inventory ledger (Git) whenever new stock arrives.

How It Works

You define an ImageRepository resource pointing to your container registry, an ImagePolicy specifying which tags to consider (latest semantic version, alphabetical, etc.), and an ImageUpdateAutomation that tells Flux where and how to commit changes.

When a new image matching your policy appears, the reflector detects it. The automation controller then scans your manifests for special markers (like # {"$imagepolicy": "flux-system:myapp"}), updates the image tag, and commits the change to Git. Flux's Kustomize controller notices the Git change and deploys it—full circle GitOps automation.

This is especially powerful for continuous deployment pipelines where your CI builds images with semantic versions or commit SHAs, and you want deployments to follow automatically.

Key Takeaway:
Flux image automation closes the GitOps loop by automatically updating Git when new container images are available, eliminating manual image tag updates while maintaining Git as the source of truth.