I’ve heard of kubernetes (or k8s) but have not used it in practice. Now that I have a handful of services running in the homelab on multiple sets of hardware, I figured I’d look into it to see if it would be worthwhile to migrate from the docker-compose approach to the most widely adopted system orchestration tool.
First step to getting going is to have a toy environment to learn the fundamental concepts. To acheive this, I’m using minikube which is a quick way to set up a kubernetes cluster and kubectl which is how you manage a cluster. First steps:
minikube start # create a cluster
minikube start -p aged --kubernetes-version=v1.34.0 # second named cluster
kubectl cluster-info # shows the control plane
kubectl create deployment hello-node --image=registry.k8s.io/e2e-test-images/agnhost:2.53 -- /agnhost netexec --http-port=8080
kubectl get pods -A # get pods across all namespaces
minikube dashboard # (optional) start a dashboard
minikube delete --all # cleanup
There’s a concept of addons for minikube as well to enable additional features. In general there is a concept of deployments, nodes, and pods.
There’s also two main items that are used to control kubernetes:
kubectlis used to manage the control planekubletis a component that manages containers for a given node. A good depiction of this is on the main compoent description:- https://kubernetes.io/docs/concepts/overview/components/
For converting the docker-compose services, will need multiple ConfigMaps. There’s also a helpful tool to get us started in the conversion from the docker-compose spec to k8s - https://kompose.io/.
Standing up a kubernetes cluster can be done with the kubeadm tool which is used to create a minimum viable Kubernetes cluster. It is recommended as a good way for trying out kubernetes - and can be deployed on a raspberry pi. Requirements are generally 2 CPU and 2+ GiB RAM with full network connectivity (e.g. this may not work well with the tunnelled reverse proxy server). To try this out. I can use the raspberry pi network I have locally if I cannot connect to the VPS.
Installation instructions are provided here: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#installing-kubeadm-kubelet-and-kubectl
The main benefit for kubernetes is to automatically have horizontal and vertical scaling for the apps. I am looking for a streamlined approach for managing containers over a network - so at this point I am haulting any further investigation into kubernetes and using docker compose to do the orchestration of the services I require in my homelab.