K3s is a lightweight distribution of Kubernetes created Rancher Labs. It can be run on a single host (or multiple). K3s is more opinionated than upstream Kubernetes, that isn't necessarily a bad thing.
The standard K3s batteries included stack is:
- Ingress - Traefik
- Container Networking - Flannel
- Persistent Storage - Local Path Provisioner - This creates persistent volumes under a local path on your system.
I setup K3s on Digital Ocean to run this Blog, Ubiquti's UniFi Controller and a few other personal projects in containers. My goal was to be able to create a container platform while keeping costs to a minimum. Digital Ocean do offer a Managed Kubernetes solution but you have to pay for Persistent Volumes and Load Balancer. I'm running a single droplet with 2 vCPU's, 4GB of memory and 80GB storage.
Unlike upstream K8s, K3s is very simple to setup. Head over to www.k3s.io and run the install instructions as root on your digital ocean droplet:
curl -sfL https://get.k3s.io | sh - # Check for Ready node, takes maybe 30 seconds k3s kubectl get node
Once K3s has finished installing you'll want to switch to using kubectl instead of the k3s client. I manage other clusters from kubectl and switch between them using kubectx.
You can install the latest version kubectl by following the install instructions here.
On your digital ocean droplet, grab the kubeconfig that rancher has generated.
Copy the contents to your local machine. For this example, we'll assume that you copied it to /tmp/kubeconfig on your local machine.
You can now remove the backup one.
If your merge was successful, you should now be able to run the get nodes command on your system.
kubectl get nodes
I'd recommend to lock down all ports apart from 80 & 443 on your Droplet to your home IP address; you can do this via the digital ocean control panel.