Scripts2026年4月15日·1 分钟阅读

Minikube — Run Kubernetes Locally on Any OS

Runs a single-node Kubernetes cluster on your laptop so you can try Kubernetes features without a cloud bill.

Introduction

Minikube is the official SIG-maintained tool for running a real Kubernetes distribution on a single machine. It shipped in 2016 as the easiest way to hack on Kubernetes without AWS or GCE, and is still the reference local cluster recommended by kubernetes.io.

What Minikube Does

  • Spins up a fully conformant Kubernetes control plane in a VM or container.
  • Provides 40+ add-ons (ingress, metrics-server, registry, GPU, CSI) via one command.
  • Exposes a LoadBalancer tunnel so Services of type LoadBalancer actually get IPs locally.
  • Supports multiple clusters side-by-side with -p profile and instant switching.
  • Caches Docker images in the VM to survive offline workflows.

Architecture Overview

Minikube provisions a VM via a pluggable driver (Docker, Podman, HyperKit, Hyper-V, VirtualBox, KVM2, QEMU). Inside it runs a full Kubernetes node (kubeadm-based) with containerd or CRI-O. A small gRPC addon manager watches a manifest directory; minikube CLI talks to the VM over SSH for mount/tunnel operations.

Self-Hosting & Configuration

  • Drivers: --driver=docker is fastest on modern boxes; qemu2 works on Apple Silicon without paid tools.
  • Resource caps: --cpus, --memory, --disk-size persist per profile.
  • Kubernetes version pin: --kubernetes-version=v1.31.0 to match prod.
  • minikube mount /src:/src bind-mounts host directories into the cluster.
  • minikube image load myapp:dev uploads locally-built images without a registry.

Key Features

  • Works identically on macOS, Linux, Windows, and Apple Silicon.
  • Multi-node clusters: minikube start --nodes 3 creates workers for HA testing.
  • First-class GPU support (--gpus=all) for ML demos.
  • Fully offline installs via minikube start --download-only plus air-gapped registries.
  • Kubernetes API is conformant — CRDs, operators, and Helm charts work unchanged.

Comparison with Similar Tools

  • Kind — Kubernetes-in-Docker, lighter and faster for CI, but fewer add-ons and no tunnel.
  • k3d — Wraps k3s in Docker; great for laptops, but not upstream Kubernetes.
  • MicroK8s — Canonical snap with strong addon story on Ubuntu, weaker on other OSes.
  • Docker Desktop Kubernetes — one click, but a single hardcoded version.
  • kubeadm on a VM — what minikube abstracts; more control, more setup.

FAQ

Q: Apple Silicon support? A: Yes — use --driver=docker with Docker Desktop or --driver=qemu2 on bare metal.

Q: How do I pull from a private registry? A: minikube addons configure registry-creds or mount a dockerconfig secret.

Q: Why is my LoadBalancer Service pending? A: Run minikube tunnel in another terminal; it allocates a routable IP.

Q: CI/CD use? A: Most pipelines prefer Kind for speed, but minikube works in GitHub Actions with the medyagh/setup-minikube action.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产