How To Install Kubernetes on Fedora 38
In this tutorial, we will show you how to install Kubernetes on Fedora 38. For those of you who didn’t know, Kubernetes is an open-source platform designed to automate containerized application deployment, scaling, and management. Its ability to orchestrate containers efficiently has made it the go-to solution for deploying and managing applications at scale.
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 the Kubernetes on a Fedora 38.
Prerequisites
- A server running one of the following operating systems: Fedora 38.
- 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 Kubernetes.
- 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 Kubernetes on Fedora 38
Step 1. Before we can install Kubernetes on Fedora 38, it’s important to ensure that our system is up-to-date with the latest packages. This will ensure that we have access to the latest features and bug fixes and that we can install Kubernetes without any issues:
sudo dnf update
Step 2. Installing Docker.
Docker plays a pivotal role in the Kubernetes ecosystem. It enables the packaging and running of containerized applications. Here’s how to get Docker up and running on your Fedora 38 system:
sudo dnf install docker
Start Docker and enable it at boot:
sudo systemctl start docker sudo systemctl enable docker
To ensure Docker is correctly installed, run the following command:
docker --version
Step 3. Installing kubectl.
kubectl is your gateway to managing your Kubernetes cluster. It’s the command-line tool that interacts with your Kubernetes environment. Here’s how to get it on your Fedora 38 system:
sudo dnf install kubectl
Confirm the installation by checking the kubectl version:
kubectl version --client
Step 4. Installing minikube.
Minikube is a fantastic tool that allows you to run a single-node Kubernetes cluster locally, providing an excellent environment for development and testing:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube
Ensure minikube is installed correctly by running:
minikube version
Step 5. Initializing Kubernetes Cluster.
With Docker, kubectl, and minikube installed, you’re now ready to set up your local Kubernetes cluster. Initialize the Kubernetes cluster with minikube:
minikube start
This command will download the required ISO image, create a virtual machine, and set up the Kubernetes cluster.
To verify that your cluster is up and running, use:
kubectl cluster-info
Step 6. Deploying a Sample Application.
Now that your Kubernetes cluster is operational, it’s time to get a feel for how Kubernetes manages applications. Let’s deploy a simple Nginx web server as a sample application:
kubectl create deployment nginx --image=nginx
Now, expose the deployment as a service:
kubectl expose deployment nginx --type=NodePort --port=80
This will expose the Nginx service on a NodePort, making it accessible from your Fedora system.
Step 7. Access the Sample Application.
To access the Nginx web server, you need to find out the NodePort it’s running on:
kubectl get svc
Look for the port under the “PORT(S)” column. It will be something like XXXX:30000/TCP
, where XXXX
is the NodePort. Open a web browser and enter http://localhost:XXXX
to see the Nginx default page.
Step 8. Managing Kubernetes Cluster.
Now that you have your sample application running, it’s essential to understand how to manage your Kubernetes cluster.
Kubernetes provides a wealth of commands for managing your cluster. Here are some basic ones:
- View Nodes: To see the nodes in your cluster, use
kubectl get nodes
. - View Pods: To list all pods in the cluster, use
kubectl get pods
. - Delete a Deployment: To remove a deployment, use
kubectl delete deployment <deployment-name>
.
To scale a deployment named “nginx” to three replicas, use the following command:
kubectl scale deployment nginx --replicas=3
Congratulations! You have successfully installed Kubernetes. Thanks for using this tutorial for installing Kubernetes on your Fedora 38 system. For additional help or useful information, we recommend you check the official Kubernetes website.