Considering I’ve created my own private cloud in my home as part of: wp-k8s: WordPress on privately hosted Kubernetes cluster (Raspberry Pi 4 + Synology). Everything works great, except when it doesn’t.
Problem of keeping RPI K8s nodes as pets
When something goes wrong with one of the cluster nodes, or the whole cluster, bootstrapping and re-provisioning these nodes took significant amount of my time and effort, by having to resort to follow numerous manual steps described as part of above mentioned blog post.
Hence, right after release of the project I’ve been thinking and working on how to do the same steps automatically with code.
I initially started by writing an Ansible playbook, just to realize I didn’t want to keep upgrading existing nodes by setting their states/configs to what they should be. This approach kept me thinking of my RPI K8s cluster nodes as my pets. Instead I found approach of getting rid and “nuking” existing node/s if something went wrong with it, and starting over from scratch much faster and seamless experience.
That’s how templating Python files, provisioning and running its output with Terraform fit this idea perfectly. Allowing me to automatically convert freshly flashed RPI devices with Ubuntu server image to ready to use Kubernetes cluster nodes in matter of minutes.
Birth of “rpi-microk8s-bootstrap” project
Please refer to its use-cases and microk8s-bootstrap module for more information.
Happy hacking & if you found this useful, consider becoming my GitHub sponsor!
Comments