Configuring Weave Flux

Installing the Flux Helm Operator

Notes taken from Stefan Prodan’s Gitops Helm repository.

The first step in automating Helm releases with Weave Flux is to create a Git repository with your charts source code. You can fork the gitops-helm project and use it as a template for your cluster config.

Add the Weave Flux chart repo:

helm repo add weaveworks https://weaveworks.github.io/flux

Install Weave Flux and its Helm Operator by specifying your fork URL (replace stefanprodan with your GitHub username):

helm install --name flux \
--set rbac.create=true \
--set helmOperator.create=true \
--set git.url=git@github.com:stefanprodan/gitops-helm \
--namespace flux \
weaveworks/flux

Adding Deploy Keys to Your Repository

At startup Flux generates a SSH key and logs the public key. Find the SSH public key with:

kubectl -n flux logs deployment/flux | grep identity.pub | cut -d '"' -f2

In order to sync your cluster state with Git you need to copy the public key and create a deploy key with write access on your GitHub repository.

Open GitHub, navigate to your fork, go to Setting > Deploy keys click on Add deploy key, check Allow write access, paste the Flux public key and click Add key.

An example project to test flux against would be the podinfo repository. Additionally, it’s also a good example of a best-practices Go application written for Kubernetes.