Kubernetes has quickly risen in popularity as the go to solution for deploying containerized applications inside of a cluster. It gives administrators many options for scaling applications, and offers advanced features like rolling updates and self healing. To get started learning about Kubernetes or to test your containerized applications in a deployment scenario, installing minikube will help immensely.
Minikube makes for a perfect testing environment for developers to see how their containerized application will run on Kubernetes, because it runs a Kubernetes cluster on a single node. In this tutorial, we will show you how to install Kubernetes on a Rocky Linux system.
In this tutorial you will learn:
- How to download and install Minikube on Rocky Linux
- How to install the
- How to interact with your Minikube single node cluster
|Category||Requirements, Conventions or Software Version Used|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Install Kubernetes on Rocky Linux step by step instructions
In case you would rather install a production ready bootstrapper for Kubernetes, see our tutorial on How to Install Kubernetes on All Linux Distros for instructions on installing kubeadm, as opposed to minikube.
- Let’s get started by installing all of the prerequisite packages we are going to need, which is just the curl command and Docker:
$ sudo dnf check-update $ sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo $ sudo dnf install curl docker-ce docker-ce-cli containerd.io
- Once Docker has finished installing, use the following commmands to start the service and to make sure it starts automatically after each reboot:
$ sudo systemctl start docker $ sudo systemctl enable docker
- Next, we need to make sure that swap space is disabled on our system, otherwise Kubernetes will fail to run. Execute the following commands to turn off swap space and permanently disable it with the sed command inside of your
$ sudo swapoff -a $ sudo sed -i '/ swap / s/^/#/' /etc/fstab
- Next, use the
curlcommand to download the latest version of the Minikube installer:
$ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-latest.x86_64.rpm
- After the download completes, use the following
rpmcommand to install the package:
$ sudo rpm -Uvh minikube-latest.x86_64.rpm
- After installation, we can launch Minikube with the following command:
$ minikube start
In some cases, you may find that you need to specify the container manager that you have on your system with the
--driveroption, such as the following command for Docker:
$ minikube start --driver=docker
- Now it is time to install the kubectl command, by executing:
$ minikube kubectl -- get po -A
- Then, to save yourself some keystrokes and sanity, create a permanent alias by adding the following line to the
alias kubectl="minikube kubectl --"
- You can now get started with creating your own deployments. Or, if you do not have your own and want to make sure that Minikube is working as intended, we can create a simple deployment and then expose it on port 8000:
$ kubectl create deployment hello-minikube --image=kicbase/echo-server:1.0 $ kubectl expose deployment hello-minikube --type=NodePort --port=8000
- Now we can use the kubectl command to verify that our deployment has launched successfully:
$ kubectl get services hello-minikube
In this tutorial, we saw how to install Kubernetes on a Rocky Linux system. Minikube is a great way to get started learning about Kubernetes, and to do a test run of deploying your containerized applications to see how they would fare in a real Kubernetes cluster. Since Minikube only creates a single node cluster, it should not be used in production, and administrators should resort to kubeadm for that scenario instead.