K8s at home – Top distros for labs and learning
Running Kubernetes at home is a great way to learn more about K8s and run real workloads to get a feel for how you can run containers in a highly-available way. All are great for learning, no matter what configuration you choose or what Kubernetes distro you start with. Nothing says you have to stick with a single Kubernetes solution. You can spin up and try multiple Kubernetes solutions to run pods at home. Let’s look at great K8s at home solutions for learning, labbing, and running workloads.
What is Kubernetes, and why run it at home?
Kubernetes is a container orchestration solution that is the de facto standard for running Kubernetes in production. Docker containers in themselves are not highly available and need a way to run in an orchestrated configuration where they can be highly available, scalable, and elastic.
Below is a look at the historic application infrastructure and what things looked like.
Kubernetes via VMware Tanzu as an example of a modern Kubernetes platform.
High availability
Kubernetes provides that solution allowing you to achieve the goal of running your containers like you would in production or in a cloud environment. Kubernetes is run in a cluster configuration to support losing a node and still having the capacity to run your workloads.
Architecture
Kubernetes clusters are made up of controller nodes and worker nodes. The control nodes host the control and management plane for the cluster and the API endpoint for interacting with the cluster programmatically.
Learning
One of the great benefits of running K8s at home is learning. With a home lab environment, you can run Kubernetes and not worry about an error or required uptime. You can learn at your own pace, look at annotations, refer to documentation, set goals, mount different types of storage and play around with these configurations enabled in the cluster, and experiment.
Secrets
With Kubernetes you can store secrets. Kubernetes Secrets are stored unencrypted in the API server’s underlying data store (etcd). Anyone can retrieve a secret via a key value store, so take note of permissions when working with secrets and keeping these safe. Enable role based access control to further protect resources in Kubernetes.
How you install containers in Kubernetes
One of the easiest ways to install containers in Kubernetes is using helm. You can think of helm as a package manager for Kubernetes. It makes pulling down common containers extremely easy.
Adding helm repository
You add your helm repository and then pull the container you want to pull using what helm refers to as a chart, which is essentially a template. The helm charts define the configuration for the container image you are pulling.
Self-hosted services
You can host your services using Kubernetes, even if you are doing this in a self-hosted way. When looking at K8s at home, most prefer to self-host web services, HTTPS, ingress path configurations, and other components for their project.
Configure ingress settings
One of the challenges with learning Kubernetes is understanding how to expose services. There are various ways to do this. However, an organization generally exposes services using an ingress controller in production deployment configurations.
Certificates and configure ingress settings
An ingress controller allows providing certificates for HTTPs, and routing incoming visit requests to the correct service hosted in the Kubernetes cluster, depending on the values in the ingress path routes.
Below we have a service hosted on an internal IP and we have the IP exposed on a loadbalancer address. However, if we didn’t want to expose the port on a loadbalancer IP, we can use an ingress path to the application. The hosts then route the traffic accordingly.
Below, we are using the Traefik ingress controller to expose a service hosted internally in the Kubernetes cluster.
K8s at home – top distros to work with
What are some top Kubernetes distros to work with using K8s at home? There are a few to mention. These include the following:
Minikube – Take a look at my post here on how to install Minikube in WSL2 with helm: Install Minikube in WSL 2 with Kubectl and Helm – Virtualization Howto
Microk8s – Microk8s is a great distribution allowing you to easily stand up a single or multi-node Kubernetes cluster at home. Take a look at my tutorial here: Microk8s ingress controller configuration with Traefik – Virtualization Howto
Tanzu Community Edition – Tanzu Community Edition 0.10 Released with Unmanaged Cluster Configuration – Virtualization Howto
Rancher desktop – Rancher Desktop v1.0 Features Installation and Configuration – Virtualization Howto
K8S at home FAQs
Let’s consider a few FAQs with Kubernetes at home:
Why run Kubernetes at home?
There are many reasons for this, including self-hosting services, highly-available containers, and learning.
What are the best distributions for running K8s at home?
There are many to choose from, including:
Minikube
Microk8s
Tanzu community edition
Rancher desktop
and K3s
Fixes to app access?
You can provide app access using ingress controllers without the need to expose all services via a loadbalancer IP address.
Wrapping Up
Running K8s at home is awesome, in terms of learning, hosting services, and running containers in a high-availability configuration. Hopefully this quick guide helps any considering self-hosting services at home with Kubernetes.