This started as a way to play with self-hosting using old laptops as nodes in a k3s cluster. Since I have a couple of old Macs around, it used multipass
to manage VMs and k3s
to deploy things into a kubernetes cluster.
Then I got a Raspberry Pi and so I wanted to be able to ditch multipass.
There are bits of this repo that are more mature than others, and some things just implemented for fun (e.g., CLI sugar with gum
). Sooner or later, it should be a collection of implementations of local FOSS projects that I'm curious to self-host.
There are many. Here are a few I looked at.
- kind
- k3s
- minikube
- microk8s
- docker-for-mac k8s
- rancher desktop
Some notable efforts I've seen to facilitate self-hosting on old computers or VMs or cloud.
- Implement sealed secrets for various deployment secrets
- Look at storage classes in cluster and figure out how to persist backends or dump backups to the local host
- Implement a Postgres DB for the mattermost backend that works on any architecture.
- Deploy
timescaledb
as helm chart - Connect
mattermost
to thistimescaledb
deployment to use as a backend DB.- Need a func for extracting connection info
- Deploy
- Expose External IP
k3s
is deployed onto multipass
VMs by the ./k3s/deploy*
scripts. Those scripts will handle creating a control-plane and N worker nodes. You can also install helm that way.
From there, it seems to be plain old kubernetes. You can expose Services
to the host via LoadBalancer
types and to the internet with Ingress
configs. Access to the cluster directly requires a shell on one of the nodes (e.g. multipass shell k3s-control-plane
).
See k3s/README.md for more info.
I'm learning along the way with k3s
... this is sort of a staging area for components and configurations I'm finding as I dig around.
- SQL Backend
- Comes with MySQL out of the box, but this doesn't support ARM64 archs.
- Allows pointing to an external db solution.
- Dynamic storage class
curl -LO https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml
sudo kubectl apply -f local-path-storage.yaml
sudo kubectl patch storageclass local-path -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
See ./helm/mattermost/README.md
I haven't yet built an install script around this, but it's easy enough. Here's how you can play with Jenkins in a dev environment if you like.
jenkins.yaml:
apiVersion: k3s.cattle.io/v1
kind: HelmChart
metadata:
name: jenkins
namespace: jenkins
spec:
chart: stable/jenkins
targetNamespace: jenkins
valuesContent: |-
Master:
AdminUser: {{ .adminUser }}
AdminPassword: {{ .adminPassword }}
rbac:
install: true
install:
sudo kubectl create ns jenkins
sudo kubectl apply -f jenkins.yaml