Menu

Post image 1
Post image 2
1 / 2
0

Per-PR Preview Environments with FluxCD

DEV Community: kubernetes·Artur Havrylov·3 days ago
#kTMpXC2s
Reading 0:00
15s threshold

You want a preview environment for every pull request - open a PR, get a working URL. On Kubernetes with Flux, there's no built-in way to get one: Kustomization and HelmRelease don't template themselves per PR. The usual workarounds each have a catch: a kubectl apply CI job - breaks GitOps, since the cluster drifts from git Argo CD ApplicationSet - now you're running two GitOps controllers a custom controller that watches your PRs - works, but it's yours to maintain There's a lighter option: the Flux Operator's ResourceSet and ResourceSetInputProvider CRDs . Two YAML files per service, no custom code, no second control plane. This post is the full setup - copy-paste-able - using a backend service called api as the example. What you'll build A preview environment for every open PR, on its own URL ( api-1234.preview.example.com ). Deploy gated on the image build - no ImagePullBackOff while CI is still running. Automatic teardown when the PR closes - no cleanup job. All in plain YAML, reconciled by Flux.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More