Minikube is a great tool for running a single-node Kubernetes cluster locally on your Ubuntu machine for development and testing purposes. This guide will walk you through the installation process step-by-step.
Before you begin:
Make sure you are using Ubuntu.
You have sudo privileges (ability to run commands as an administrator).
Your computer has internet access.
Virtualization support is enabled on your machine (check by running the command
egrep -c '(vmx|svm)' /proc/cpuinfo
. If the output is 0, virtualization is disabled; if it's 1, it's enabled).
Steps to install Minikube on Ubuntu:
Update your system packages:
This ensures you have the latest versions of software and dependencies.
sudo apt update
Install required packages:
sudo apt install -y curl wget apt-transport-https
This installs some basic packages that Minikube needs to run.
Install Docker:
Minikube can run a Kubernetes cluster in a virtual machine (VM) or locally via Docker. This guide will use Docker.
sudo apt install -y docker.io
This installs Docker on your system.
Next, start and enable Docker so it runs in the background.
sudo systemctl enable --now docker
Then, add your current user to the docker group so you can use Docker without needing root privileges.
sudo usermod -aG docker $USER && newgrp docker
Note: After adding yourself to the group, you will need to log out and log back in for the changes to take effect.
Install Minikube:
First, download the Minikube binary using curl:
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
Then, make the downloaded file executable and move it to your path so you can run it from anywhere in your terminal.
chmod +x minikube
sudo mv minikube /usr/local/bin/
Install kubectl:
kubectl is a command-line tool for interacting with Kubernetes clusters. Download it using curl.
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
Make the downloaded file executable and move it to your path.
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
Start Minikube:
Now you can start Minikube with the following command:
minikube start --driver=docker --vm=true
This command will start a single-node Kubernetes cluster inside a Docker container on your machine.
Verify the installation:
Check the status of your Kubernetes cluster using the following command:
minikube status
You should see output indicating that the cluster is running.
You can also use kubectl to interact with your cluster. Try running the following command to see the list of nodes in your cluster:
kubectl get nodes
Stop Minikube (optional):
When you're finished using Minikube, you can stop the cluster with this command:
minikube stop
Delete Minikube (optional):
If you no longer need Minikube, you can completely remove it from your system using the following command:
minikube delete
Congratulations! You have now successfully installed Minikube on your Ubuntu machine. You can now start deploying Kubernetes applications for development and testing purposes.