Should I Bootstrap Flux with Terraform or the Flux CLI?
Asked by
MellowCedar42
I'm setting up Flux on a Kubernetes cluster and am considering a few approaches: Terraform with Helm, the Terraform Flux provider, or running the Flux bootstrap command from a CI runner. I don't ultimately want Terraform to manage Flux after the initial setup. Is there a practical reason to use Terraform for bootstrapping, or is the Flux CLI the simpler and more appropriate choice?
Answers
Terraform and Flux can work together, especially when Terraform owns the cluster and related cloud resources. It can pass infrastructure valuesโsuch as certificate IDs, network information, or security group namesโto Kubernetes through seeded secrets or other configuration. That can be useful, but itโs more of an integration pattern than a requirement for bootstrapping Flux.
Reply to this answer
Another option is to install the Flux Operator with Helm and define a FluxInstance resource in your infrastructure repository. The operator can then reconcile that instance, which points Flux at the repository containing its configuration. From there, Flux manages its own setup through GitOps, so Terraform doesnโt need to remain involved.
Reply to this answer
The main reason to use Terraform is repeatability and recovery. Consider whether you can recreate an entire environment with one documented process, including the permissions and secrets needed to run bootstrap. If rebuilding clusters, development environments, or disaster-recovery environments is important, managing the bootstrap declaratively may be worthwhile. Otherwise, the CLI is likely enough.
Reply to this answer
If Flux is the only thing youโre bootstrapping and you already have a working CI runner, the Flux CLI is usually the simplest option. Bootstrap is generally a one-time operation, and Flux can then manage its own manifests declaratively through Git. Using Terraform adds another layer unless you already use it to provision the surrounding infrastructure.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions