
Minikube is a lightweight Kubernetes implementation that lets you run a cluster locally for development and testing. It is an excellent tool for learning Kubernetes without needing cloud infrastructure.
In this guide, we’ll cover:
- Installing Minikube
- Starting and managing a Minikube cluster
- Deploying applications on Minikube
- Managing resources and debugging
- FAQs and troubleshooting tips
Prerequisites
Before diving into Minikube, ensure you have:
- A system with virtualization enabled (for VirtualBox, HyperKit, KVM, or Docker)
- kubectl installed (Install Guide)
- Minikube installed (Install Guide)
Step 1: Installing and Starting Minikube
1. Install Minikube (Mac/Linux/Windows)
# macOS (Homebrew)
brew install minikube
# Linux (Using curl)
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
# Windows (Chocolatey)
choco install minikube
2. Start Minikube
minikube start --driver=docker # Start with Docker
minikube start --driver=virtualbox # Start with VirtualBox
3. Verify Cluster Status
kubectl cluster-info
minikube status
Step 2: Deploying Applications on Minikube
1. Creating a Deployment
kubectl create deployment nginx-deployment --image=nginx
2. Exposing the Deployment as a Service
kubectl expose deployment nginx-deployment --type=NodePort --port=80
3. Accessing the Application
minikube service nginx-deployment --url
Step 3: Managing Resources and Debugging
1. Checking Cluster Nodes and Pods
kubectl get nodes
kubectl get pods -A
2. Viewing Logs
kubectl logs -f <pod-name>
3. SSH into the Minikube Node
minikube ssh
4. Pausing and Resuming Minikube
minikube pause # Pause the cluster
minikube unpause # Resume the cluster
5. Stopping and Deleting Minikube
minikube stop # Stop the cluster
minikube delete # Delete the cluster
FAQs:
Q1: How do I enable Kubernetes addons in Minikube?
A: Minikube provides built-in addons like dashboard and metrics-server.
minikube addons enable dashboard
minikube dashboard
Q2: How do I increase CPU and memory for Minikube?
A: Specify resources when starting Minikube.
minikube start --cpus=4 --memory=8192
Q3: How do I mount a local directory into Minikube?
A: Use Minikube’s mount command.
minikube mount /path/to/local/dir:/mnt/data
Q4: How do I access services without minikube service?
A: Use port forwarding.
kubectl port-forward svc/nginx-deployment 8080:80
Q5: How do I use Minikube with an Ingress controller?
A: Enable the Ingress addon and deploy an Ingress resource.
minikube addons enable ingress
kubectl apply -f ingress.yaml
Conclusion
Minikube is an excellent tool for local Kubernetes development, allowing you to test workloads without needing a cloud provider.
Key Takeaways:
✅ Install Minikube with a compatible driver (Docker, VirtualBox, etc.)✅ Deploy and expose applications with kubectl✅ Manage resources using minikube commands✅ Use addons like Ingress and Dashboard for advanced workflows
If you found this guide helpful, follow me for more Kubernetes and DevOps tutorials! 🚀
📢 Have questions or feedback? Drop a comment below or connect with me on Twitter/X@spysood!
Originally published on Medium.