GitOps is the deployment model where infrastructure and applications are managed and configured via simple YAML in Git repo.
Flux is a Continuous Delivery platform for Kubernetes deployed using native Kubernetes resources.
curl -s https://fluxcd.io/install.sh | sudo bash
Create a repo dedicated to your Kubernetes cluster manifests.
flux bootstrap git \
--url=ssh://git@GIT_HOST:GIT_USER/GIT_REPO
--branch=GIT_BRANCH
--path=PATH_TO_CONFIG
Example:
flux bootstrap git --url=ssh://[email protected]/joeheaton/k8s.1e100 --branch=main --path=config/clusters/dev
Flux bootstrap supports GitHub PAT (Personal Access Tokens), this example uses the GitHub CLI to add Flux-generated deploy keys.
Create a GitHub PAT with the Repository Permissions:
Administration: Read/Write
Contents: Read/Write
.
flux bootstrap github \
--owner joeheaton \
--repository k8s.1e100 \
--branch cluster-dev \
--path ./config/clusters/dev/ \
--personal
# Login to GitHub.com via Web Browser
gh auth login -p ssh -h github.com -w
# Send the key to gh
echo KEY_GENERATED_BY_FLUX | gh repo deploy-key add -t Test -
To update Flux-system, run: flux reconcile source git flux-system
.
Flux can push messages to a chat webhook, Flux supports multiple chat providers: https://fluxcd.io/flux/guides/notifications/
To enable notifications first we create a secret containing the webhook URL:
kubectl -n flux-system create secret generic flux-notify-webhook --from-literal="address=https://WEBHOOK_URL"
Configure the chat provider in config/clusters/*/flux-notifications/release.yaml
by replacing googlechat
with your provider.