🎯
Container Platform

Minikube

Run a local Kubernetes cluster on your laptop for development

🐧 Linux🍎 Mac🪟 Windows📋 Quick reference →
Reviewed: Tested on: Kubernetes 1.29 · Terraform 1.8 · Ubuntu 22.04

If you're on Kubernetes 1.27 or older

  • Ingress: networking.k8s.io/v1 is required — v1beta1 removed in 1.22+
  • Pod Security: PodSecurityPolicy removed in 1.25 — use Pod Security Admission (PSA) labels
  • HPA v2 autoscaling/v2 is stable — check API version in manifests

If you're on Kubernetes 1.28

  • Sidecar containers (1.29+) change init-container ordering — review sidecar docs before upgrade
  • Verify metrics-server and HPA after control plane bump

Alternative — team standard for Local Kubernetes

What is this?

Minikube runs a small Kubernetes cluster on your laptop for learning and testing.

📁

Config files for Minikube

Where to create or edit the main configuration — paths below match the setup steps.

  • ~/.kube/config

    Location: Updated by minikube start

    Points kubectl at local Minikube cluster

📥

Step 01

Install Minikube

(01)Install

Linux
1curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
2sudo install minikube-linux-amd64 /usr/local/bin/minikube
3minikube start --driver=docker
⚙️

Step 02

Configure Minikube

(01)Start with custom resources

Linux
1minikube start --cpus=4 --memory=8192 --driver=docker
2minikube addons enable ingress
3minikube addons enable metrics-server
4minikube addons list

(02)Load local images and deploy

Linux
1docker build -t myapp:local .
2minikube image load myapp:local
3kubectl create deployment myapp --image=myapp:local
4kubectl expose deployment myapp --type=NodePort --port=8080
5minikube service myapp --url

Step 03

Verify

(01)Cluster status

Linux
1minikube status
2kubectl get nodes

Step 04

Manage Minikube

(01)Common commands

Linux
1minikube start
2minikube stop
3minikube delete
4minikube dashboard
5minikube service my-svc --url
6minikube image load myapp:local

📋Config templates

2 YAML templates for Minikube. Copy and deploy after setup.

2 ready-to-copy templates. Expand one, copy the YAML, then run the deploy commands.

deployment.yml

Deployment with resource requests/limits and local image

yaml
1apiVersion: apps/v1
2kind: Deployment
3metadata:
4 labels:
5 app: api-deploy
6 name: api-deploy
7spec:
8 replicas: 1
9 selector:
10 matchLabels:
11 app: api-deploy
12 template:
13 metadata:
14 labels:
15 app: api-deploy
16 spec:
17 containers:
18 - image: api:local
19 name: api
20 imagePullPolicy: IfNotPresent
21 ports:
22 - containerPort: 3000
23 resources:
24 limits:
25 memory: "512Mi"
26 cpu: "500m"
27 requests:
28 memory: "256Mi"
29 cpu: "250m"

services.yml

NodePort Service exposing the API on port 32000

yaml
1apiVersion: v1
2kind: Service
3metadata:
4 labels:
5 app: api-deploy
6 name: api-deploy-service
7spec:
8 type: NodePort
9 selector:
10 app: api-deploy
11 ports:
12 - port: 3000
13 protocol: TCP
14 targetPort: 3000
15 nodePort: 32000
📄

Step 01

Apply to Kubernetes

(01)Build image and load into cluster

Linux
1# Build local image
2docker build -t api:local .
3
4# For Minikube / Kind — load image into cluster
5minikube image load api:local
6# OR: kind load docker-image api:local

(02)Apply manifests

Linux
1kubectl apply -f deployment.yml
2kubectl apply -f services.yml
3kubectl get pods,svc
4curl http://localhost:32000 # or minikube service api-deploy-service