Minikube is a tool that enables developers to run a local Kubernetes cluster for testing and development. It’s lightweight and supports various environments.
Key Features
- Local Kubernetes Cluster:
- Runs a single-node Kubernetes cluster on your local machine.
- Multi-Driver Support:
- Works with Docker, VirtualBox, KVM, Hyper-V, and others.
- Customizable Resources:
- Configure CPU, memory, and disk allocation as needed.
- Addons:
- Supports additional Kubernetes features such as metrics-server, ingress, and dashboard.
- Cross-Platform:
- Compatible with Linux, macOS, and Windows.
Installation
For Linux
1
2
| curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
|
For MacOS
Set driver
1
| minikube config set driver <docker|kvm2|virtualbox>
|
View config
Start or Create Minikube cluster
Start with different network
1
2
3
| docker network create --subnet=192.168.100.0/24 minikube-net
minikube start --driver=docker --network=minikube-net
|
Stop Minikube cluster
Destroy Minikube cluster
Check status of Minikube cluster
Launch Minikube cluster dashboard
1
| minikube dashboard --port=8085 --url
|
See Minikube IP
Access Minikube bash
Enable specific Minikube add-on
1
| minikube addons enable <addon>
|
Access service exposed by Minikube
1
| minikube service <service-name>
|
Install Kubernetes dashboard ingress using DNS
We will use a wildcard test dns *.k8s.pvt.one
which is pointed to 192.168.49.2
. So, it will be easy to resolve without modifying of hosts
file.
1
| kubectl -n kubernetes-dashboard edit svc kubernetes-dashboard
|
Change the type
field from ClusterIP
to NodePort
:
Save and exit the editor.
Get the NodePort: Run the following command to find the NodePort:
1
| kubectl -n kubernetes-dashboard get svc kubernetes-dashboard
|
Enable ingress-
1
| minikube addons enable ingress
|
Create an Ingress YAML File: Save the following content to dashboard-ingress.yaml
:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: dashboard-ingress
namespace: kubernetes-dashboard
spec:
rules:
- host: dashboard.k8s.pvt.one
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: kubernetes-dashboard
port:
number: 80
|
Apply dashboard ingress-
1
| kubectl apply -f dashboard-ingress.yaml
|
See ingress details for dns and ip attachments
1
| kubectl get ingress -n kubernetes-dashboard
|
Now visit this dashboard url:
1
| http://dashboard.k8s.pvt.one
|
Access remote Minikube cluster from local kubectl
command