Deploy from git with Flux
The flux add-on keeps a cluster in step with a branch of your {{product}} git repository, over a deploy key {{product}} manages.
Replace my-cluster with your cluster's name or id and platform-config with one of your git repositories.
The flux add-on runs Flux's source, kustomize and helm controllers. Each repository in its
options becomes a GitRepository (the branch, fetched over SSH) and a Kustomization of one path in
it: Flux applies what is there every interval, and with prune it deletes what you remove from
the repository. A path holds plain manifests or a kustomization.yaml; HelmReleases work too.
- No key to manage. When you install the add-on, Deutsche Cloud registers a read-only deploy key
eks-flux-<cluster id>on each listed repository and gives the cluster its private half. It is deleted when you remove the repository from the options, remove the add-on or delete the cluster. - Who controls the cluster. Flux applies the branch with cluster-admin rights: whoever can push to it controls the cluster. Protect the branch (pull requests, reviews) as you would the cluster's admin access.
Prerequisites
- Permission for
eks:CreateAddonon the cluster andgit:CreateDeployKeyon each repository. In the console, alsoeks:DescribeClusterto open the cluster.
Install the add-on
- Open Kubernetes, open the cluster, then choose Add-ons.
- Choose Add an add-on, then GitOps (Flux).
- Choose the repository, and the branch and path if they are not
mainand the root. - Choose Install.
dcloud eks addons create my-cluster --name flux --config 'repositories=[{"repository":"platform-config","path":"./clusters/prod"}]'POST /eks/api/clusters/my-cluster/addons
{ "name": "flux", "config": { "repositories": [{ "repository": "platform-config", "path": "./clusters/prod" }] } }resource "dcloud_eks_addon" "flux" {
cluster_id = dcloud_eks_cluster.main.id
name = "flux"
config = jsonencode({
repositories = [{ repository = "platform-config", path = "./clusters/prod" }]
})
}See what it applied
kubectl -n flux-system get gitrepositories,kustomizationsREADY True with the commit it applied; a failing apply names the object and the error. The
deploy key is listed under the repository's Settings › Deploy keys.