Skip to main content
In this hands‐on walkthrough, you’ll use Flux’s ImageUpdateAutomation controller to detect new container image tags, commit updates to your Git repository, and deploy the changes automatically on your Kubernetes cluster.

Overview of Resources


Prerequisites

  • A Kubernetes cluster with Flux v0.34+ installed.
  • A Git repository containing your application’s Kubernetes manifests under ./manifests.
  • An ImagePolicy resource in flux-system (e.g., 8-demo-image-policy-bb-app) selecting the desired image tags.
For more details, see the Flux Image Automation Guide and the Flux CLI reference.

1. Inspect the Flux CLI for Image Updates

Open a terminal in your cluster directory and verify the ImageUpdateAutomation commands:
You should see usage details for creating an ImageUpdateAutomation resource, which watches a Git repo and applies image tag updates to your manifests.

2. Create the ImageUpdateAutomation Resource

Generate the ImageUpdateAutomation YAML without applying it:
Inspect 8-demo-image-update-bb-app.yml:

3. Configure the GitRepository Source

Define your application Git source and reconcile it:
At this stage, ImageUpdateAutomation will report no updates made, since it doesn’t know where in your manifests to apply new tags.

4. Mark the Deployment Manifest for Automated Updates

Ensure an ImagePolicy named 8-demo-image-policy-bb-app exists in flux-system to select the desired image tags.
Edit manifests/deployment.yml and annotate the image field:
Commit and push your changes:

5. Handle Git Authentication for Push Access

After marking the manifest, the controller locates the change but cannot push:
The image shows a GitHub repository page with a branch selection dropdown open, displaying various branches like "2-demo" and "9-demo." The page includes options for code management, such as "Compare & pull request" and "Add a README."
Go to your GitHub repository Settings → Deploy keys:
The image shows a GitHub repository settings page, specifically the "Deploy keys" section, indicating that there are no deploy keys for the repository.
Generate a deploy key secret and apply it:
Copy the public key from the secret and add it in GitHub as a write deploy key. Authenticate if prompted:
The image shows a GitHub "Confirm access" page prompting the user to enter their password to proceed. It includes a password input field, a "Confirm" button, and links for terms, privacy, and security.

6. Reconfigure GitRepository Source to Use SSH

Regenerate the GitRepository to reference your SSH URL and secret:

7. Final Reconciliation and Verification

Trigger the image update and verify the new tag is committed and deployed:
Now Flux will commit the updated tag (e.g., 7.8.1) to your manifests/deployment.yml. Confirm on GitHub:
The image shows a GitHub repository page for "bb-app-source" with a focus on the "manifests" directory, displaying files like "deployment.yml," "namespace.yml," and "service.yml." The branch is 16 commits ahead and 1 commit behind the main branch.
Finally, ensure the new image is running in your cluster:
Expected output:
The image shows a game interface for "Block Buster" with details like pod name, IP, and app version. It prompts the user to "PRESS START" to begin the game.

Congratulations! You’ve successfully automated image tag updates with Flux’s ImageUpdateAutomation controller.

Watch Video

Practice Lab