Minikube is a tool that allows you to run a Kubernetes cluster locally on your computer. It creates a local Kubernetes cluster with a single node. The cluster can run inside a container or a virtual machine depending on the selected driver.
Prerequisites
Before starting, make sure the following are installed:
- Docker
- kubectl
- Minikube
You should also have basic knowledge of Kubernetes concepts such as Pods, Deployments, and Services.
Install Minikube
Minikube provides installation packages for Linux, macOS, and Windows.
For Linux, Minikube can be installed using:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64sudo install minikube-linux-amd64 /usr/local/bin/minikube
Verify the installation:
minikube versionInstall kubectl
kubectl is the command-line tool used to communicate with the Kubernetes cluster.
Verify whether kubectl is already installed:
kubectl version --clientIf it is not installed, install it according to your operating system.
Start the Minikube Cluster
Start the local Kubernetes cluster using the Docker driver:
minikube start --driver=dockerMinikube creates the Kubernetes cluster and configures kubectl to communicate with it.
Once the cluster starts successfully, you can verify its status.
minikube statusA running cluster should show the Minikube components in a Running state.
Verify the Kubernetes Cluster
Check the available nodes:
kubectl get nodesYou should see a node with the status:

Open the Minikube Dashboard
Minikube provides a Kubernetes Dashboard that can be used to view and manage cluster resources.
Enable the Dashboard:
minikube addons enable dashboardStart the Dashboard:
minikube dashboardThe Dashboard opens in the default web browser.
It can be used to view resources such as:
- Nodes
- Pods
- Deployments
- Services
- ConfigMaps
- Secrets

Deploy an Application on Minikube
After creating the cluster, we can deploy a simple Nginx application.
Create an Nginx Deployment:
kubectl create deployment nginx --image=nginxCheck the Deployment:
kubectl get deploymentsCheck the Pod created by the Deployment:
kubectl get podsThe Pod should eventually show the Running status.

Expose the Application
A Kubernetes Service can be used to expose the Nginx application.
Create a NodePort Service:
kubectl expose deployment nginx --type=NodePort --port=80Check the Service:
kubectl get servicesThe Service exposes the Nginx application through a port on the Minikube node.

Access the Application
Minikube provides a simple command to open a Service in the browser.
Run:
minikube service nginxMinikube opens the Nginx application in the default browser.

You can also get the Service URL without opening the browser:
minikube service nginx --urlCheck Kubernetes Resources
You can use kubectl commands to inspect the resources running in the cluster.
List all Pods:
kubectl get podsList Deployments:
kubectl get deploymentsList Services:
kubectl get servicesList all resources:
kubectl get all
Stop the Minikube Cluster
When you finish working with the cluster, you can stop it without deleting the cluster.
minikube stopThe cluster and its resources are preserved and can be started again later.
Start it again using:
minikube startDelete the Minikube Cluster
If you no longer need the cluster, you can delete it completely.
minikube deleteThis removes the Minikube cluster and its associated resources.
Common Commands
| Command | Description |
|---|---|
minikube start | Starts the Minikube cluster |
minikube status | Checks the cluster status |
minikube stop | Stops the cluster |
minikube delete | Deletes the cluster |
minikube dashboard | Opens the Kubernetes Dashboard |
minikube addons list | Lists available Minikube add-ons |
minikube addons enable dashboard | Enables the Dashboard |
minikube service nginx | Opens the Nginx Service |
minikube service nginx --url | Displays the Nginx Service URL |
kubectl get nodes | Lists Kubernetes nodes |
kubectl get pods | Lists Pods |
kubectl get deployments | Lists Deployments |
kubectl get services | Lists Services |