Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Kubernetes with Minikube: Getting Started

· 5 min read · Home Tech

In this article
  1. What Is Minikube and Why Use It?
  2. Prerequisites and Installation
  3. Core Workflow: Deploying an Application
  4. Common Commands and Management
  5. Common Problems and Fixes
  6. Minikube vs. Other Local Kubernetes Options
  7. Moving from Minikube to a Real Cluster
  8. Frequently Asked Questions

To get started with Kubernetes using Minikube, you install Minikube, start a local cluster with minikube start, and then use kubectl to deploy and manage containerized applications. Minikube runs a single-node Kubernetes cluster on your laptop or desktop, making it the fastest way to learn Kubernetes fundamentals without cloud infrastructure.

What Is Minikube and Why Use It?

Minikube is a lightweight tool that runs a Kubernetes cluster locally. It creates a virtual machine (or uses a container runtime like Docker) on your machine, then installs the core Kubernetes components inside that environment. The result is a fully functional, single-node cluster that behaves like a real Kubernetes cluster for development and testing.

You'd use Minikube when you want to:

  • Learn Kubernetes concepts (Pods, Deployments, Services, ConfigMaps) hands-on.
  • Develop and test applications locally before deploying to a cloud cluster.
  • Run CI/CD tests that need a real Kubernetes API.
  • Experiment with cluster features without incurring cloud costs.

Prerequisites and Installation

Before installing Minikube, you need a hypervisor or container runtime. Minikube supports Docker, VirtualBox, HyperKit (macOS), Hyper-V (Windows), and KVM (Linux). The easiest path is to have Docker installed, as Minikube can use it directly.

Installation steps:

  1. Install kubectl – the Kubernetes command-line tool. Download it from the Kubernetes release page or use your package manager (e.g., brew install kubectl on macOS, snap install kubectl on Ubuntu).
  2. Install Minikube – download the binary from the Minikube GitHub releases page, or use package managers like brew install minikube (macOS), choco install minikube (Windows), or snap install minikube (Linux).
  3. Start the cluster – run minikube start. This creates a VM (or container) and sets up the cluster. The first start downloads a small ISO image, so it may take a few minutes.

After starting, verify with kubectl get nodes – you should see a node named minikube with status Ready.

Core Workflow: Deploying an Application

Once the cluster is running, you interact with it using kubectl. Here's a typical workflow:

  1. Create a deployment – kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
  2. Expose the deployment – kubectl expose deployment hello-minikube --type=NodePort --port=8080
  3. Get the service URL – minikube service hello-minikube – this opens your browser to the app.
  4. Clean up – kubectl delete service hello-minikube and kubectl delete deployment hello-minikube.

For a more realistic example, you can create a YAML file for a deployment and apply it with kubectl apply -f deployment.yaml. This is how you'll manage applications in production too.

Common Commands and Management

Minikube provides several commands to manage your local cluster:

  • minikube status – shows cluster status.
  • minikube stop – stops the VM but keeps the cluster configuration.
  • minikube start – restarts a stopped cluster.
  • minikube delete – destroys the cluster (use if you want a fresh start).
  • minikube dashboard – opens the Kubernetes dashboard web UI.
  • minikube logs – shows Minikube logs for troubleshooting.
  • minikube addons list – shows available add-ons (e.g., ingress, metrics-server).

You can also enable add-ons like the metrics server (minikube addons enable metrics-server) to see resource usage in kubectl top.

Common Problems and Fixes

New users often hit a few predictable issues:

  • VM driver not found – If you don't have a hypervisor, Minikube will error. Install Docker or specify a driver with --driver=docker.
  • Resource limits – Minikube defaults to 2 CPUs and 2GB RAM. If your machine is low on resources, use --cpus=1 --memory=2048.
  • kubectl can't connect – Make sure kubectl is configured to use the Minikube context: kubectl config use-context minikube.
  • Image pull errors – If you're behind a proxy or have a slow connection, images may fail. Try minikube start --image-mirror-country=cn (if in China) or set proxy environment variables.
  • Cluster won't start after a crash – Run minikube delete and then minikube start again.

Minikube vs. Other Local Kubernetes Options

Minikube isn't the only way to run Kubernetes locally. Here's how it compares:

  • Kind (Kubernetes in Docker) – Runs Kubernetes nodes as Docker containers. Faster startup, but no VM isolation; good for CI testing.
  • K3s – Lightweight Kubernetes distribution, often used on edge devices. Can run locally with k3d (K3s in Docker).
  • MicroK8s – Snap-based single-node cluster, popular on Linux. Simple to install, but less portable across OSes.
  • Docker Desktop – Includes a built-in Kubernetes cluster. Easy for Docker users, but limited to one node and requires Docker Desktop's paid tier for some features.

Minikube is the most feature-complete for learning because it supports add-ons and multiple drivers, and it's the official Kubernetes project's local cluster tool.

Moving from Minikube to a Real Cluster

Once you're comfortable with Minikube, you'll want to deploy to a cloud cluster (EKS, AKS, GKE) or an on-premises cluster. The key difference is that cloud clusters are multi-node and have production features like load balancers, autoscaling, and persistent storage. The YAML manifests you write for Minikube will work on any Kubernetes cluster, but you'll need to adjust Service types (e.g., from NodePort to LoadBalancer) and handle cloud-specific storage classes.

To prepare, practice with:

  • Namespaces and resource quotas.
  • ConfigMaps and Secrets.
  • PersistentVolumeClaims.
  • Helm charts for packaging.
  • Ingress controllers (enable the ingress add-on in Minikube).

Frequently Asked Questions

Do I need to install Docker to use Minikube?

No, but it's the easiest path. Minikube can use VirtualBox, Hyper-V, or KVM as drivers. If you don't have a hypervisor, installing Docker is recommended because Minikube can use it as a driver without extra setup.

How much RAM/CPU does Minikube need?

Minikube's default is 2 CPUs and 2GB RAM. For basic tutorials, 1 CPU and 2GB RAM is sufficient. If you run heavy workloads, allocate more, but ensure your host machine has at least 4GB free.

Can I use Minikube for production?

No. Minikube is a single-node cluster designed for development and testing. It lacks high availability, persistent storage, and production security features. Use it to learn and test, not to serve real traffic.

How do I reset Minikube to a clean state?

Run minikube delete to remove the VM and all cluster data. Then start fresh with minikube start. This is useful if you've broken something and can't fix it.

What's the difference between kubectl and minikube?

kubectl is the Kubernetes command-line tool that talks to any cluster's API server. Minikube is a tool that creates and manages a local cluster. You use minikube to start/stop the cluster, and kubectl to interact with it.

Can I run multiple Minikube clusters?

Yes, you can use minikube start -p cluster2 to create a second cluster with a different profile. Each profile has its own VM and configuration. Use minikube profile list to see them.