Edit: URL is here: https://github.com/xelab04/KubernetesWorkshop
Contributions welcome :)
I'm quite pleased to announce this pretty cool piece of software I created. After a lot of deliberation, I have decided to call it Hobby Raft.
The idea behind the name is that, unlike the container ship Kubernetes is often compared to, this platform deals with making rafts which are much smaller, shabbier boats.
Currently, the platform is pretty much only an API. It runs on a master node of an existing Kubernetes cluster and, upon request, creates a virtual cluster, exposes it, and sends the user the kubeconfig file.
That's it. That's the whole project.
If you insist, I can explain a bit more about how it works!
The whole project is based around vcluster, which is an amazing utility developed by Loft Labs. Thankfully, it is licensed under the Apache 2 license which gives people like me free reign to do practically anything with it - be it a free or commercial project.
Vcluster allows the creation of virtual Kubernetes clusters on top of an existing cluster. This whole project actually originates from me needing a platform to run a Kubernetes workshop at the annual Developer's Conference here in Mauritius, and I was too lazy to figure out a more popular platform such as Rancher's Hobby Farm. Not to mention I think the latter requires you to spin up clusters through VMs which has led the platform to be dependent on AWS or DO cloud. So not only is it resource heavy, but I can't self host it on my own hardware.
The intention is to dynamically spin up virtual Kubernetes clusters on demand so that each attendee participating in the workshop has their own cluster, isolated from everyone else. Isolation is of course possible through namespaces but if you have 70 or so attendees, it will become a nightmare to ensure access permissions and prevent any potential conflicts between them!
Very simply, the project, as it is at the time of writing, is a Python Flask API. Why Python and not Go, you may ask? Well, I don't know Go. So Python it is.
The project is just one endpoint really. It does a few things.
- Reserve a port on the master. This port will be used for a Kubernetes service which will act as a "tunnel" from the outside world (attendee's laptop) to the virtual API server running in the host Kubernetes cluster.
- Create the service. I use Jinja for filling in a service template with the cluster's name and the nodeport reserved earlier.
- Create the cluster. I cheat here. It's a simple bash command and I use subprocess to run it in Python. Dirty but works.
- Retrieve the kubeconfig file. The kubeconfig file is your license to use the Kubernetes cluster. It contains certs and quite a few other details to allow you to actually interact with the API server. Afterwards, the file is sent to the attendee to use from their laptop.
Should I add some authentication? Probably. What about a GUI? Mayhaps. What about a cli in the browser? Perchance.
So what's coming in the future? Well at DevCon 2024, we're unveiling the local Cloud Native Chapter. And with it, I would be extremely happy to transfer ownership of this application to the community, where it can grow and be developed better than if I were the sole dev. I am hoping that this project evolves to be a fully fledged platform with a nice GUI and maybe even terminal/ssh in the browser. To my knowledge, there are not many workshop/training platforms targeting Kubernetes, and I would be happy to collaborate with corporations seeking to upskill their IT teams in Kubernetes and Cloud Native technologies. My wildest dream for this project is seeing it be used at KubeCon in the future :D
So on that note, aiming for the moon, I would like to thank you for showing interest in Hobby Raft and the local Cloud Native community. Please stay tuned for future updates!