Many beginners face a problem when it comes to installing the minikube. I also faced this problem so many times when I install a new OS. Even if you follow the documentation you will still not be able to install it.
Many new bugs occurred during the installation and you don't know how to solve them. The documentation doesn't mention those bugs during the installation.
After struggling for three days, I finally installed minikube and I decided to write about this topic so that other people do not face this problem.
I am using Zorin OS. It's a Linux distribution based on Ubuntu. In this blog, all the installation commands are related to Ubuntu.
Let's jump into the installation process.
- Install Docker
- Install Kubernetes
- Install Kubectl
- Install Conntrack
- Install Minikube
1. Install Docker
The first step starts with the installation of Docker. It is an open platform for developing, shipping, and running applications.
First, you have to write the sudo su
command to get into the root. After that, just write:
sudo apt update && apt -y install docker.io
This command will update the system and then install the docker. After installation, write docker version
to get the details of docker.
2. Install Kubernetes
The next step is to install Kubernetes from the official website. Here is the command that you need to run.
curl -Ls "https://sbom.k8s.io/$(curl -Ls https://dl.k8s.io/release/latest.txt)/release" | awk '/Package: registry.k8s.io\// {print $3}'
3. Install Kubectl
The third step is to install kubectl. You can either install it from the official website or you can use this command to install it.
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl
Copy the link as it is. This command will install kubectl, change its permission and then move the kubectl file into the /usr/local/bin
.
Once the installation is completed, write kubectl version
to get the details of kubectl.
If you want to know more about kubectl then here is a FREE cheatsheet for you.
4. Install Conntrack
Connection tracking (“conntrack”) is a core feature of the Linux kernel’s networking stack. It allows the kernel to keep track of all logical network connections or flows, and thereby identify all of the packets which make up each flow so they can be handled consistently together.
To install the conntrack, type:
sudo apt install conntrack
5. Install Minikube
This is the last and most important part. Although all the above packages were not facing issues but this single package requires other packages also to install it. Type this single command:
First Try
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
After running the above command on your machine, if you type:
minikube start --vm-driver=none
It will give you the following error.
Second Try
Now we need to install the cri-dockerd
to start the minikube.
Use wget to install the cri-dockerd:
wget https://github.com/Mirantis/cri-dockerd/releases/download/v0.2.0/cri-dockerd-v0.2.0-linux-amd64.tar.gz
Next, unzip the package:
tar xvf cri-dockerd-v0.2.0-linux-amd64.tar.gz
Move the cri-dockerd binary to your usr/local/bin directory:
sudo mv ./cri-dockerd /usr/local/bin/
Now if you write whereis cri-dockerd
, you will see its path.
Start the service on Linux
Now you’ll need to configure systemd by running the following commands one by one:
wget https://raw.githubusercontent.com/Mirantis/cri-dockerd/master/packaging/systemd/cri-docker.service
wget https://raw.githubusercontent.com/Mirantis/cri-dockerd/master/packaging/systemd/cri-docker.socket
sudo mv cri-docker.socket cri-docker.service /etc/systemd/system/
sudo sed -i -e 's,/usr/bin/cri-dockerd,/usr/local/bin/cri-dockerd,' /etc/systemd/system/cri-docker.service
…and start the service with cri-dockerd enabled:
systemctl daemon-reload
systemctl enable cri-docker.service
systemctl enable --now cri-docker.socket
You can verify that the service is running with:
systemctl status cri-docker.socket
In the end, run this command,
sudo chmod 666 /var/run/docker.sock
After doing all the above steps, if you type minikube start
, it will give you another error which you can see:
Third Try
Now install the crictl
because it is not found as you see in the screenshot. Below are the four commands to run to install crictl
:
VERSION="v1.25.0"
wget https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-amd64.tar.gz
sudo tar zxvf crictl-$VERSION-linux-amd64.tar.gz -C /usr/local/bin
rm -f crictl-$VERSION-linux-amd64.tar.gz
After running the above commands, if you write minikube start --vm-driver=none
, it will again give you an error.
This time, it is giving us some warnings as you can see in the above screenshot.
Fourth Try
The swap is enabled. Now let's disable it by writing:
sudo swapoff -a
The ethtool is not found. Let's install it by writing:
sudo apt-get install -y ethtool
The socat is not found. Let's install it by writing:
sudo apt-get install -y socat
Kubelet service is not enabled. Let's enable them:
systemctl enable kubelet.service
Let's try again to writing minikube start --vm-driver=none
. This time it will definitely work. Please make sure to have a strong internet connection while starting.
Mistake: Here in the above screenshot, I just wrote minikube start
but you should write minikube start --vm-driver=none
.
If it is still not working, delete minikube by writing minikube delete
and start again by writing minikube start --vm-driver=none
.
Note: After closing the terminal and starting again, if you face another issue like minikube failed to start : Exiting due to HOST_JUJU_LOCK_PERMISSION then run this command to resolve it.
rm /tmp/juju-*
I hope it will help you. Please share it with others if you find it valuable.
Follow me on YouTube, Twitter, and LinkedIn.
Thank you!