A GitOps demonstration with the Redis Enterprise Operator.
The Guest book demo in this project is based on the excellent example in kubernetes/examples repo.
That demo has been modified to accept REDIS_HOST
, REDIS_PORT
and REDIS_PASSWORD
as environment variables, to make it easier to connect an app to the Redis DB.
We want changes to the git repo to be reflected in our k8s cluster. Following the fluxCD getting started guide:
- install fluxctl
- Create the flux namespace:
kubectl create ns flux
- Install flux on your cluster, using fluxctl:
You will need to use your github user and point to a fork of this repo.
export GHUSER="YOURUSER" fluxctl install \ --git-user=${GHUSER} \ --git-email=${GHUSER}@users.noreply.github.com \ --git-url=git@github.com:${GHUSER}/GitopsWithRedisEnterpriseOperator \ --git-path=workloads \ --namespace=flux | kubectl apply -f -
- Wait for flux to start:
kubectl -n flux rollout status deployment/flux
- At startup Flux generates a SSH key and logs the public key. Find the SSH public key by running:
fluxctl identity --k8s-fwd-ns flux
- 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, give it a Title, check Allow write access, paste the Flux public key and click Add key. See the GitHub docs for more info on how to manage deploy keys.
- Make changes, and see that your demo workloads are changing.
- By default, Flux git pull frequency is set to 5 minutes. You can tell Flux to sync the changes immediately with:
fluxctl sync --k8s-fwd-ns flux