Home Local K8s Clusters
Post
Cancel

Local K8s Clusters

Local Kubernetes Cluster Tools

Kubernetes is a powerful container orchestration tool that automates the deployment, scaling, and management of containerized applications. However, setting up a Kubernetes cluster can be a daunting task. Thankfully, there are several tools available that allow developers to easily create local Kubernetes clusters on their own machines for development and testing purposes. Here are a few of them:

1. Minikube

Minikube is a tool that makes it easy to run Kubernetes locally. It runs a single-node Kubernetes cluster inside a Virtual Machine (VM) on your laptop for users looking to try out Kubernetes or develop with it day-to-day 1.

1
2
3
4
5
# Start Minikube
minikube start

# Check the status
minikube status

2. Kind (Kubernetes in Docker)

Kind stands for Kubernetes in Docker. It is a tool for running local Kubernetes clusters using Docker container “nodes”. Kind was primarily designed for testing Kubernetes itself, but may be used for local development or CI 2.

1
2
3
4
5
# Create a cluster
kind create cluster

# Check the clusters
kind get clusters

3. MicroK8s

MicroK8s is a small, fast, single-package Kubernetes for developers, IoT, edge, CI/CD. It’s perfect for offline development, prototyping, testing, and on-rails production workloads 3.

1
2
3
4
5
# Install MicroK8s
sudo snap install microk8s --classic

# Check the status
microk8s status

4. K3s

K3s is a lightweight Kubernetes distribution by Rancher Labs that’s perfect for edge, IoT, CI, and ARM. It’s packaged as a single binary and is great for situations where a minimal Kubernetes installation is preferred 4.

1
2
3
4
5
# Install K3s
curl -sfL https://get.k3s.io | sh -

# Check the status
k3s kubectl get node

5. Docker Kubernetes

Docker Desktop includes a standalone Kubernetes server that runs on your Windows or Mac workstation, so you can test deploying your Docker workloads on Kubernetes 5.

1
2
3
4
5
# Enable Kubernetes
# This is done via the Docker Desktop UI: Preferences -> Kubernetes -> Enable Kubernetes

# Check the context
kubectl config get-contexts

6. K3d

K3d is a lightweight wrapper to run Rancher Lab’s k3s in Docker. It’s great for local development and testing. K3d creates containerized k3s clusters. This means, that you can spin up and down a full Kubernetes cluster on your local machine with just one command 6.

1
2
3
4
5
# Create a cluster
k3d cluster create mycluster

# Check the clusters
k3d cluster list

Each of these tools has its own strengths and weaknesses, and the choice between them depends on your specific needs. However, they all provide an easy way to get a Kubernetes cluster up and running on your local machine.

I have often leveraged these tools for POCs, configuration validations, testing CRDs and addons. A typical example is this repo which is a POC for a simple managed application hosted on kubernetes sharing the same codebase, leveraging on tools like Helm7 for kubernetes manifest packaging, nginx-ingress controller8 for traffic management, k3d6 for cluster deployment and Terraform9 for IaC

This post/article is licensed under CC BY 4.0 .