Minikube is an open-source tool for those who are looking for a lightweight Kubernetes distribution designed for local development and testing purposes. The beauty of MiniKube is it allows users to run a single-node Kubernetes cluster even on their local machine. In this article, we will guide you through the process of installing Minikube on an Ubuntu 22.04 Linux but you can follow this tutorial on other similar Linux or older versions of Ubuntu as well.
To start following this tutorial you need the following things:
- An Ubuntu-based system (this tutorial was performed on Ubuntu 22.04 LTS).
- User account on the system with sudo privileges.
- A working internet connection.
1. Update Ubuntu 22.04 Linux
It is not absolutely necessary to run the system update command before following the tutorial but recommended. This will rebuild the package index cache for the APT package manager so that it can recognize the latest versions of the software available through the system repositories.
sudo apt update -y
After updating, install a few other tools we will require in this tutorial.
sudo apt install curl wget apt-transport-https -y
2. Use KVM or Docker as a Minikube driver
If you are using Windows then you can use VirtualBox for MiniKube to run virtual machines but for Linux KVM (Kernel-based Virtual Machine) or Docker are preferred to use as a driver because of performance. Here we will show how to install Docker and KVM on Ubuntu, you can choose any one of them, if not have already.
If you don’t have any of them then only install one either KVM or Docker, no need for both.
Check out our tutorial on how to install Docker in Ubuntu 22.04.
Check whether Virtualization support is enabled on your machine or not:
egrep -q 'vmx|svm' /proc/cpuinfo && echo yes || echo no
Note: If the output is ‘YES“, then follow further otherwise restart your PC and enable it in BIOS.
After that install the KVM and its other tools:
sudo apt install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon
Add your user to libvert group
sudo adduser -a $USER libvirt sudo adduser -a $USER libvirt-qemu
newgrp libvirt newgrp libvirt-qemu
3. Download MiniKube binary
Next, we need to download the MiniKube binary available to download for Linux. We can get it using the command line tool cURL.
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
4. Install and Start MiniKube on Ubuntu 22.04
After having the binary of MiniKube on your Ubuntu 22.04 system, use the given command that will install it under your local folder, so that it can be accessible throughout the system using the terminal.
sudo install minikube-linux-amd64 /usr/local/bin/minikube
To check the version run:
5. Install the Kubernetes command-line tool
To manage cluster resources, deploy applications, and inspect logs of Kubernetes clusters, we can use its command-line tool called
kubectl. Here we will install that using the few commands given below.
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x ./kubectl
sudo mv kubectl /usr/local/bin/
To check the kubectl version, run:
kubectl version --client --output=yaml
6. Start MiniKube with KVM Driver on Ubuntu 22.04
We can use multiple drivers to deploy Minikube, however, for good performance here we are going for the docker, you can go for KVM, if you want, you just need to replace the docker in the given command with KVM2.
minikube start --vm-driver docker
However, even if we do not mention a particular driver in the above command, the system will automatically select and use the KVM. However, if we have VirtualBox and Docker installed, it is good to mention which driver you actually want to use for running Minikube. For more details on this see the Driver Documentation.
Well, once the installation is completed, we can check it using the given commands for more information.
• For status :
• For accessing the Minikube command line via ssh:
You can use it to create Docker containers, easily.
• To know what the Minikube Add-ons are currently active or enabled, use:
minikube addons list
• To check Cluster info
• To see what are the nodes currently active:
kubectl get nodes
• For the default configuration view of the cluster
kubectl config view
• To stop and delete the Minikube cluster:
minikube stop minikube delete
7. Run Minikube Dashbaord on Ubuntu 22.04
Minikube comes with an add-on called Dashboard which automatically gets enabled by running the given command in this step. Hence we can start it to access the web-based Kubernetes user interface for deploying container applications & managing the cluster, get an overview of resources, and more…
On your local system where you have installed this Kubernetes implementation, the browser will open to automatically give you the Dashboard web interface.
8. Access Kubernetes Dashboard externally or remotely (optional)
If you are using Minikube on your local Ubuntu 22.04 Server running with only a command-line interface and want to access the MiniKube Dashboard, remotely on some other computer available in the same network of your Server. Then instead of using the previous step command, you can use the kubectl proxy to open local 8001 for accessing the Web interface of Kubernetes.
kubectl proxy --address='0.0.0.0' --disable-filter=true
Note: To restrict the web interface access to some particular IP address, replace 0.0.0.0 in the above command with that. Otherwise, any system in the network will be able to access the Dashboard.
Once you have executed the above command, open any browser that can access the ip-address of the Server running Minikube and point it to: