-
|
Ok, so here is what I want to do. I want to spin up hundreds of clusters and I want all of these clusters too look exactly the same. My thought was to make a single git repo with a single cluster definition. And then point each cluster/flux to that single git repo and have flux sync the cluster. A simple diagram of roughly what I mean (although with many more clusters) I'm thinking I'm just "doing something wrong" or there is a better way of what I would like to do. I want flux to keep all these clusters in sync with each other as far as deployed applications. Making an update to the repo would then effectively update all of the clusters. I did quite a bit of googling (and maybe I just failed to search for the right term but I found: #1819 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
|
I think that you can do this, currently only if you are managing SSH keys by hand. When you run I have not tested this, but I believe it would work. You can manage multiple SSH deploy keys by hand on a repo and populate the flux-system secret for the flux-system gitrepository by hand in each replicated cluster. You have to be sure that multiple replicas that are identical do not all run their own Image Update Automation, which seems to be the main sticking point in documenting this mode of working, since we would want to provide that Image Update Automation support and never suggest that it should be avoided. They (the replica clusters) should each use Flux in read-only mode, to prevent a race between different update agents that might all decide independently to reconcile Flux update automation at different times and generate conflicts between each other. But one Flux "updater" cluster would be in charge of writing updates. This could work within the current design, without coloring too far outside of the lines I think. You can find more information about identical environments in the https://github.com/fluxcd/flux2-kustomize-helm-example#identical-environments heading of the flux2-kustomize-helm-example doc. Please note though, that this method describes something different than what you are attempting to accomplish here. The documented method assumes that you will inevitably want some replicas to diverge, either temporarily or permanently, and so it provides that each cluster can be bootstrapped separately and upgraded independently, with most of the common manifests coming from a common kustomize overlay base. Maybe you already found this and ruled it out because of the differences. What you're trying to do specifically is not documented. I am not sure if there's any reason we couldn't support it as a use case and document it separately, but you should know that you are heading into undocumented territory, you may find unexpected surprise behaviors or you may encounter inconsistencies that require a work-around. The most obvious one is actually described above -- if one cluster has read-write credentials so that it can run ImageUpdateAutomation and the other clusters do not run Image Update Controllers, then you really have at least two different cluster specs, and they are not identical replicas anymore. (In a way that is accounted for in the example from flux2-kustomize-helm-example, but still not described all that fully.) The two cluster specs would diverge in |
Beta Was this translation helpful? Give feedback.

I think that you can do this, currently only if you are managing SSH keys by hand.
When you run
flux bootstrap, each cluster gets its own Deploy key which is managed based on the path that bootstrap is ran against. This way Flux enforces that eachbootstraprefers to an individual specific cluster only, where that cluster is represented by a path that belongs to it (example:./clusters/my-cluster). You can of course rewrite thegotk-sync.yamlto use an access method that does not require publishing a new Deploy key onto the repo, like connecting with an HTTPS endpoint and a PAT, or even a public HTTPS repo which is not protected by access controls and is read-only for the many identical F…