Various scripts for automated k8s cluster bootstrap and management with fluxcd.
Scripts are created and tested in Linux (Ubuntu) environment but should work on any system with Bash and basic tools installed to default executable PATH.
Requirements
- Running 'empty' k8s cluster
- Configured and working local environment with kubectl connecting to the k8s cluster by default
- Commandline tools installed and available in executable PATH
- pwgen
- kubectl
- kubeseal - https://github.com/bitnami-labs/sealed-secrets/releases
- fluxcd - https://fluxcd.io/docs/installation/
- kustomize - https://kubectl.docs.kubernetes.io/installation/kustomize/
- git
- yq - https://github.com/mikefarah/yq/
- Bash
Initial setup:
- Create config file for configuration settings and backup, ie.
mkdir ~/.tigase-flux
. If you wish to put config in a different location, setTIG_CLUSTER_HOME
variable to point to this location. This will be used asCONFIG
variable. - Copy entire
envs
folder to ${CONFIG}/envs:cp -rv envs ${CONFIG}/
- Edit
cluster.env
file. Following properties are mandatory to be set:
CLUSTER_NAME
- your k8s cluster name, this will be your git repo name as well.GITHUB_USER
andGITHUB_TOKEN
- your github credentials.SSL_EMAIL
- email provided to letsencrypt during SSL certificates generation and renewal.
- Non mandatory but necessary for longhorn backups on S3 object storage, change properties:
LH_S3_BACKUP...
Usage:
The main script to bootstrap fluxcd on k8s custer with all basic services is cluster-bootsrap.sh
. Normally if the environment is correctly configured and tested this is all that needs to be run.
It may take a few minutes but everything is setup automatically with no input from the user.
However, on a fresh system, it is recommended to run bootstrap scripts manually one by one. -q
option can be added to the script for fully automated execution.
flux-bootstrap.sh
- flux bootstrap, git repository setup and creating basic repo structurecluster-common-sources.sh
- deploying helm sources to flux system on k8s clustercluster-sealed-secrets.sh
cluster-kubernetes-dashboard.sh
cluster-ingress-nginx.sh
cluster-cert-manager.sh
cluster-longhorn.sh
cluster-kube-prometheus-stack.sh
cluster-loki-stack.sh