A couple of days ago, Rancher labs released k3s, a lightweight, fully compliant production-grade Kubernetes. The entire thing runs out of a 40MB binary, runs on x64 and ARM, and even from a docker-compose. Saying that this is a great engineering feat is an understatement.
I tried it out as soon as I saw the announcement. I expected their initial release to show promise, but to be rough around the edges. Was I in it for a surprise!
I decided to go with the docker-compose way so I didn’t have to deal with downloads, configs, and all that. I went ahead, got the compose manifest, and launched it.
$ mkdir ~/k3s
After about 30 seconds, I had my k3s instance up and running.
k3s’ docker-compose drops the kubeconfig file in the same folder you started it at. Great pattern!
$ export KUBECONFIG=~/k3s/kubeconfig.yaml
Once your cluster is ready, install Rancher’s local path provisioner, so we can use the local storage of your k3s node.
$ kubectl apply -f [https://gist.githubusercontent.com/rberrelleza/58705b20fa69836035cf11bd65d9fc65/raw/bf479a97e2a2da7ba69d909db5facc23cc98942c/local-path-storage.yaml](https://gist.githubusercontent.com/rberrelleza/58705b20fa69836035cf11bd65d9fc65/raw/bf479a97e2a2da7ba69d909db5facc23cc98942c/local-path-storage.yaml)
We built okteto to quickly create development environments in your kubernetes cluster. k3s is a fully compliant Kubernetes distro. Will they work together? Only one way to figure it out (full disclosure: I’m one of Okteto’s founders).
For this experiment, I went with our Python Sample App. I cloned the repository and deployed the app with
git clone https://github.com/okteto/python-getting-started.git
kubectl apply -f manifests
Once the application is ready, I used okteto to launch my development environment in my k3s instance (install okteto from here).
$ okteto up
With the application now running, I fired up my browser and went to http://localhost:8080 to see the app up and running.
Finally, I went ahead and did some mock dev work to try my entire workflow. I opened the
app.py file in VS Code and modified the response message on line 7 to be Hello world from the cluster!. Save your changes.
I went back to the browser. The changes were automatically reloaded (thanks to python hot reloader) without having to build a container, pick a tag, redeploy it or even refresh my browser! 😎
k3s is an amazing product. It has some issues (I couldn’t get outbound network connections to work). But If this is the first release, I can’t wait and see what they come up with in the near future.
Kudos to the team at Rancher for taking the fully compliant approach. With this, their users can leverage the entire ecosystem from day one!