How To Install Minikube on AlmaLinux 9
In this tutorial, we will show you how to install Minikube on AlmaLinux 9. Kubernetes is a powerful container orchestration platform, and Minikube is the perfect tool to set up a local Kubernetes cluster for development and testing purposes. AlmaLinux, a community-driven Linux distribution, provides a solid foundation for this endeavor.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of Minikube on AlmaLinux 9. You can follow the same instructions for CentOS and Rocky Linux or RHEL-based.
Prerequisites
- A server running one of the following operating systems: AlmaLinux 9.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Minikube.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Minikube on AlmaLinux 9
Step 1. Before diving into the installation process, ensure your AlmaLinux 9 system is up-to-date. Run the following commands in your terminal:
sudo dnf clean all sudo dnf update
The first command cleans up the package cache, and the second command performs the system update.
Step 2. Installing Necessary Packages.
Minikube relies on a few packages. Install them using dnf
:
sudo dnf install -y curl kubectl
Step 3. Setting up a Non-Root User with Sudo Privileges.
It’s a best practice to create a dedicated non-root user for Minikube. Replace meilanamaria
with your desired username:
sudo useradd -m -s /bin/bash meilanamaria sudo passwd yourusername sudo usermod -aG wheel meilanamaria
Now, switch to your new user:
su - meilanamaria
Step 4. Installing Minikube on AlmaLinux 9.
Before you can run Minikube, you need to set up a virtualization environment. First, check if your CPU supports hardware virtualization:
grep -E 'svm|vmx' /proc/cpuinfo
If there’s output, your CPU supports virtualization. Next, install KVM-related packages:
sudo dnf install -y @virtualization
Enable and start the libvirtd
and virtlockd
services:
sudo systemctl enable --now libvirtd virtlockd
Kubectl is the command-line tool for interacting with Kubernetes clusters. Let’s install it:
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/
Minikube itself is a lightweight Kubernetes implementation that runs inside a virtual machine. Here’s how to install it:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube
Step 5. Configuring Minikube.
Now that Minikube is installed, you can start it:
minikube start --driver=kvm2
This command initializes Minikube with the KVM2 driver. It might take a few minutes, so be patient. Once it’s up and running, you’ll see a message confirming the cluster’s creation.
Verify the status of your Minikube cluster:
minikube status
Step 6. Configuring kubectl.
To manage your Minikube cluster effectively, you’ll need to configure kubectl:
kubectl config use-context minikube
Checking the Cluster Status
kubectl cluster-info
By default, kubectl interacts with the default
namespace. Let’s set it explicitly:
kubectl config set-context --current --namespace=default
Step 7. Managing Minikube.
You can now manage your Minikube cluster with ease:
### Starting Minikube ### minikube start ### Stopping Minikube ### minikube stop ### Pausing Minikube ### minikube pause ### Resuming Minikube ### minikube unpause ### Deleting Minikube ### minikube delete
Step 8. Accessing the Kubernetes Dashboard.
The Kubernetes Dashboard provides a graphical user interface for managing your cluster. Let’s set it up:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
Accessing the Dashboard from a Web Browser:
kubectl proxy
Now, open your web browser and navigate to http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
.
Step 9. Deploying Your First Application.
Let’s deploy a simple Nginx application to get started. First, create a file named nginx-deployment.yaml
with the following content:
apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: replicas: 2 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx-container image: nginx:latest
Apply the deployment to your cluster:
kubectl apply -f nginx-deployment.yaml
To verify that your application is running, use the following command:
kubectl get pods
Congratulations! You have successfully installed Minikube. Thanks for using this tutorial for installing Minikube on your AlmaLinux 9 system. For additional help or useful information, we recommend you check the official Minikube website.