Skip to content

Blueprint to set up FluxCD with a bucket source only (no git required)

Notifications You must be signed in to change notification settings

nbrns/flux-bucket-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Flux Bucket Setup (With S3)

The idea of this repository is to run FluxCD without a git server but the Bucket Source. This means, Flux bootstrapping takes place only using a Bucket Source. This allows local setups of Flux without a running git server. We will use the Flux generic bucket type, however in this example it will be backed by an AWS S3. You can go for any S3 compatible storage, e.g. a local minio.

Local Kubernetes Cluster Setup

Set up a local Kubernetes cluster e.g. using minikube.

minikube start --driver=docker

Flux Setup

Make sure to install flux cli first.

Instead of using the flux bootstrap command, which will bootstrap a git repository by default, we will take the manual path.

Export the Flux GOTK components

mkdir -p clusters/local/flux-system
flux install --export > clusters/local/flux-system/gotk-components.yaml

Install the GOTK components on the cluster (install Flux CRDs and instantiate base controllers in namespace flux-system)

kubectl apply -f clusters/local/flux-system/gotk-components.yaml

Setup The Bucket Source (S3 Example)

Create the bucket (make sure to install aws cli and configure it with aws configure)

aws s3api create-bucket --bucket flux-local-setup-test --region us-east-1

NOTE: If you wish to use another bucket name, make sure to change the bucketName in the Bucket spec of gotk-sync.yaml as well.

Upload your manifests to the bucket

aws s3 cp --recursive ./clusters/ s3://flux-local-setup-test/clusters/

Edit and save the contents of the flux-credetials.yaml file. It should similar to this:

---
apiVersion: v1
kind: Secret
metadata:
  name: flux-system-bucket-credentials
  namespace: flux-system
type: Opaque
data:
  # Paste your secret data here and think of using SOPS to encrypt secrets, cf. https://fluxcd.io/docs/guides/mozilla-sops/
  accesskey: <ACCESS_KEY>
  secretkey:  <ACCESS_KEY_SECRET>

Apply the secret

kubectl apply -f flux-credentials.yaml

Apply the source

kubectl apply -f clusters/local/flux-system/gotk-sync.yaml

Now Flux starts syncing and creates the demo application in apps for you.

NOTE: The source sync is usually established by the flux bootstrap command, which generates the necessary manifests. Thus, be careful when applying changes to the source sync, as it is essential for Flux to work.

Cleanup

If desired, cleanup the local cluster by minikube delete.

About

Blueprint to set up FluxCD with a bucket source only (no git required)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published