Raspberry Pi Cluster, Part 8 - Automation
07 Nov 2021- Raspberry Pi Cluster, Part 1 - Hardware
- Raspberry Pi Cluster, Part 2 - Assembly
- Raspberry Pi Cluster, Part 3 - Operating Systems
- Raspberry Pi Cluster, Part 4 - Jekyll and Docker
- Raspberry Pi Cluster, Part 5 - Kubernetes
- Raspberry Pi Cluster, Part 6 - Dynamic DNS
- Raspberry Pi Cluster, Part 7 - SSL
- Raspberry Pi Cluster, Part 8 - Automation
Wow, this has turned into a much bigger series that I initially planned! Well done if you have made it this far! I promise this is the last once (for now).
At this point, the cluster is up and running and it is serving secure website pages over the Internet. However, there is a small issue with our setup whereby any changes that we wish to publish on the site requires us to got through the process of recreating the docker image and then logging into Kubernetes to redeploy it. It’s a bit of a faff.
To do this after pushing up a change to DockerHub, we can restart the Kubernetes deployment to pull down the latest image with:
kubectl rollout restart deploy blog-website
But that will get tiresome quickly. This is where Keel comes in. It’s a very handy little app that will monitor our DockerHub repo and then update our Kubernetes deployment as and when we push up a new version of our website image.
Installing Helm
To install Keel, we need to first install Helm. It’s the package manager for Kubernetes and uses charts to deployment predefined manifests on to Kubernetes clusters. It’s easy to install, run each of these three commands in order:
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
As per the K3S documentation, we need to set and Environment Variable to allow Helm to work properly, set this with:
export KUBECONFIG=~/.kube/config
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
chmod 600 ~/.kube/config
Setup Webhook Relay forwarding
helm upgrade –install webhookrelay-operator –namespace=auto-deploy webhookrelay/webhookrelay-operator \ –set credentials.key=$RELAY_KEY –set credentials.secret=$RELAY_SECRET
What’s next?
- Host a private Docker image repository
- Use solar/wind energy
- Optimising the Kubernetes deployment. Maybe remove Traefik and install Nginx Ingress.
- Use a CI/CD service like CircleCI
- Replace the last 2 3b+ Pi with 2Gb Pi 4s