minikube
π³ Minikube Setup Guide
π Overview
π― Set Up Kubernetes Locally with Minikube
This guide walks you through setting up a single-node Kubernetes cluster using Minikube, ideal for development and learning purposes.
π What This Guide Covers
- π³ What is Minikube - Local Kubernetes cluster
- πͺ Windows Installation - Step-by-step setup
- π§ Linux Installation - Ubuntu/Debian setup
- π§ Configuration - Minikube settings
- π Starting Cluster - Launch Minikube
- π Dashboard - Kubernetes dashboard access
- β Verification - Test your setup
π³ What is Minikube?
Minikube allows you to set up a Kubernetes cluster within a single VM. It's ideal for environments with limited resources, primarily used by developers or for learning purposes.
β¨ Key Characteristics
- Single Node: Runs entire cluster in one VM
- Lightweight: Minimal resource requirements
- Easy Setup: Simple installation and configuration
- Development Friendly: Perfect for local development
- Learning Tool: Great for learning Kubernetes
- Not for Production: Not recommended for production use
π Use Cases
- Development: Local development environment
- Testing: Test applications before deployment
- Learning: Learn Kubernetes concepts
- Prototyping: Quick prototyping and experimentation
- CI/CD: Local testing in CI/CD pipelines
πͺ Minikube Installation on Windows
π Prerequisites
Virtualization Check
Ensure virtualization is enabled on your system:
systeminfo
Look for the following output to confirm virtualization support:
Hyper-V Requirements:
VM Monitor Mode Extensions: Yes
Virtualization Enabled In Firmware: Yes
Second Level Address Translation: Yes
Data Execution Prevention Available: Yes
Required Software
- VirtualBox: Download from virtualbox.org
- Hyper-V: Alternative to VirtualBox (built-in on Windows Pro/Enterprise)
- Administrator Access: Required for installation
Step 1οΈβ£: Download kubectl
Download the latest release of kubectl:
curl -LO "https://dl.k8s.io/release/v1.32.0/bin/windows/amd64/kubectl.exe"
Step 2οΈβ£: Download Minikube
Download the latest release of Minikube:
curl -Lo minikube.exe https://github.com/kubernetes/minikube/releases/latest/download/minikube-windows-amd64.exe
Step 3οΈβ£: Create Minikube Directory
Create a directory and move Minikube to the C drive:
New-Item -Path "C:\" -Name "minikube" -ItemType "directory" -Force
Move-Item .\minikube.exe C:\minikube\minikube.exe -Force
Step 4οΈβ£: Set Up Environment Variables
Add Minikube and kubectl to your PATH:
- Open System Properties β Environment Variables
- Add
C:\minikubeto PATH - Add kubectl location to PATH
- Restart PowerShell
Step 5οΈβ£: Start Minikube
Run the following command to start Minikube:
minikube start
This will:
- Launch a VM in VirtualBox
- Install Kubernetes inside the VM
- Configure kubectl to connect to the cluster
Step 6οΈβ£: Verify Installation
Verify Minikube is running:
kubectl get pods
π§ Minikube Installation on Linux
Step 1οΈβ£: Install VirtualBox
sudo apt-get update
sudo apt-get install -y virtualbox
Step 2οΈβ£: Download kubectl
curl -LO "https://dl.k8s.io/release/v1.32.0/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
Step 3οΈβ£: Download Minikube
curl -Lo minikube https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-amd64
chmod +x minikube
sudo mv minikube /usr/local/bin/
Step 4οΈβ£: Start Minikube
minikube start
Step 5οΈβ£: Verify Installation
kubectl get pods
π§ Minikube Configuration
Common Minikube Commands
| Command | Purpose |
|---|---|
minikube start | Start Minikube cluster |
minikube stop | Stop Minikube cluster |
minikube delete | Delete Minikube cluster |
minikube status | Check cluster status |
minikube dashboard | Open Kubernetes dashboard |
minikube ssh | SSH into Minikube VM |
minikube logs | View Minikube logs |
Start with Custom Configuration
# Specify memory
minikube start --memory=4096
# Specify CPU cores
minikube start --cpus=4
# Specify driver (virtualbox, hyperv, docker)
minikube start --driver=virtualbox
# Specify Kubernetes version
minikube start --kubernetes-version=v1.32.0
π» Accessing Minikube Cluster
SSH into Minikube VM
On Windows (using PuTTY)
- Get Minikube IP:
minikube ip
- Use PuTTY to connect:
- Host:
<minikube-ip> - Username:
docker - Password:
tcuser
- Host:
On Linux/macOS
minikube ssh
Access Kubernetes API
# Get cluster info
kubectl cluster-info
# Get nodes
kubectl get nodes
# Get all resources
kubectl get all
π Launching Kubernetes Dashboard
Open Dashboard
minikube dashboard
This command:
- Launches the Kubernetes dashboard
- Opens it in your default browser
- Displays all cluster resources
Dashboard Features
- Pods: View and manage pods
- Deployments: Create and manage deployments
- Services: View services and endpoints
- Namespaces: Switch between namespaces
- Logs: View container logs
- Terminal: Execute commands in containers
β Verification Checklist
After installation, verify everything is working:
# Check Minikube status
minikube status
# Check cluster info
kubectl cluster-info
# Check nodes
kubectl get nodes
# Check pods in all namespaces
kubectl get pods --all-namespaces
# Check services
kubectl get services
Expected Output
$ minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready control-plane 5m v1.32.0
π Deploy Your First Application
Create a Simple Deployment
# Create a deployment
kubectl create deployment hello-minikube --image=kicbase/echo-server:1.0
# Expose the deployment
kubectl expose deployment hello-minikube --type=NodePort --port=8080
# Get service info
kubectl get service hello-minikube
# Access the service
minikube service hello-minikube
π οΈ Troubleshooting
Issue: Minikube fails to start
Solution:
# Check logs
minikube logs
# Delete and restart
minikube delete
minikube start
Issue: kubectl cannot connect
Solution:
# Check kubeconfig
kubectl config view
# Reset kubeconfig
minikube update-context
Issue: Insufficient resources
Solution:
# Allocate more resources
minikube delete
minikube start --memory=4096 --cpus=4
β Best Practices
- Stop When Not Using: Stop Minikube to save resources
- Regular Updates: Keep Minikube and Kubernetes updated
- Backup Configuration: Backup kubeconfig files
- Use Namespaces: Organize resources with namespaces
- Monitor Resources: Monitor CPU and memory usage
- Clean Up: Delete unused resources regularly
- Document Setup: Document your Minikube configuration
- Test Before Production: Always test in Minikube first
π Navigation
β¬ οΈ Previous: Kubernetes Installation
π Current Location: Minikube Setup (You are here)
β‘οΈ Next Step: Cluster Setup
πΊοΈ Full Path: Installation β Minikube β Cluster Setup β Pods
π Additional Resources
- π Minikube Official: minikube.sigs.k8s.io
- π Minikube Documentation: minikube.sigs.k8s.io/docs
- π‘ Kubernetes Dashboard: kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard
π Excellent! Minikube Setup Complete! π