Introduction
Minikube is open source software for setting up a single-node Kubernetes cluster on your local machine. The software starts up a virtual machine and runs a Kubernetes cluster inside of it, allowing you to test in a Kubernetes environment locally.
This tutorial will show you how to install Minikube on CentOS 7 or CentOS 8.
Prerequisites
- A system running CentOS 7 or CentOS 8 (CentOS 6 reached End-Of-Life in November 2020)
- A user account with sudo privileges
- Access to a terminal window / command line
How to Install Minikube on CentOS
Step 1: Updating the System
The first step is to update the local repository to ensure the software you download is up to date:
sudo yum -y update
Note: This tutorial is also available for Ubuntu 18.04 and 20.04.
Step 2: Installing KVM Hypervisor
Since you are going to run the single node cluster inside a virtual machine, you need to set up a virtualization software. This quick tutorial shows you how to set up a KVM hypervisor. For a more detailed installation guide, please refer to the article How To Install KVM On CentOS.
1. Start by installing the required packages:
sudo yum -y install epel-release
sudo yum -y install libvirt qemu-kvm virt-install virt-top libguestfs-tools bridge-utils
2. Then, start and enable the libvirtd service:
sudo systemctl start libvirtd
sudo systemctl enable libvirtd
3. Confirm the virtualization service is running with the command:
systemctl status libvirtd
The output should tell you the service is active (running)
.
4. Next, add your user to the libvirt group:
sudo usermod -a -G libvirt $(whoami)
5. Then, open the configuration file of the virtualization service:
sudo vi /etc/libvirt/libvirtd.conf
6. Make sure that that the following lines are set with the prescribed values:
unix_sock_group = "libvirt"
unix_sock_rw_perms = "0770"
7. Finally, restart the service for the changes to take place:
sudo systemctl restart libvirtd.service
Step 3: Installing Minikube
Note: You are using the wget command to download Minikube. If you don’t have the software installed on your CentOS, run the command: sudo yum -y install wget
.
With the virtualization service enabled, you can move on to installing Minikube.
1. Download the Minikube binary package using the wget
command:
wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
2. Then, use the chmod command to give the file executive permission:
chmod +x minikube-linux-amd64
3. Finally, move the file to the /usr/local/bin
directory:
sudo mv minikube-linux-amd64 /usr/local/bin/minikube
4. With that, you have finished setting up Minikube. Verify the installation by checking the version of the software:
minikube version
The output should display the version of Minikube installed on your CentOS.
Step 4: Installing Kubectl
Apart from installing Minikube, you also need to set up kubectl, the command line tool for working with Kubernetes.
1. Run the following command to download kubectl:
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
2. Give it executive permission:
chmod +x kubectl
3. Move it to the same directory where you previously stored Minikube:
sudo mv kubectl /usr/local/bin/
4. Verify the installation by running:
kubectl version --client -o json
Step 5: Starting Minikube
To start using Minikube and start a single node cluster inside a virtual machine, you just need to run the command:
minikube start
Working with Kubernetes
Now that you have set up the required software and launched your single-node cluster, you can start experimenting with Kubernetes locally.
Take a look at our section on managing Kubernetes with Minikube which covers commonly used commands in the Minikube dashboard. We also recommend learning how to build optimized containers for Kubernetes and reading up on Kubernetes security best practices. If you advance to more complex deployments, learn how to install Prometheus on Kubernetes and use it for monitoring.
Conclusion
After reading this article, you should have successfully installed Minikube on your CentOS 7 or CentOS 8. Now you can explore all the possibilities Kubernetes has to offer, on your local machine.
If you want to learn more about Kubernetes, take a look at our Complete Guide.