1080*80 ad

Minikube on CentOS Stream 10: Using Podman

A Developer’s Guide to Local Kubernetes: Minikube and Podman on CentOS Stream 10

Setting up a local Kubernetes environment is essential for modern cloud-native development. It allows you to test applications, experiment with configurations, and learn the ins and outs of container orchestration without the cost and complexity of a full-scale cloud cluster. While Docker has traditionally been the go-to container runtime, Podman is rapidly emerging as a powerful, secure, and more integrated alternative, especially on RHEL-based systems like CentOS Stream.

This guide provides a comprehensive walkthrough for setting up Minikube on CentOS Stream 10 using the Podman driver. By the end, you’ll have a fully functional, single-node Kubernetes cluster running directly on your machine.

Why Choose Podman with Minikube?

Before we dive in, it’s worth understanding why this combination is so compelling. Unlike Docker, Podman offers a daemonless architecture. This means it doesn’t require a constantly running background service, which can improve system performance and reduce the potential attack surface.

Key advantages include:

  • Enhanced Security: Podman can run containers in a rootless mode by default, which significantly improves security by preventing container processes from gaining root privileges on the host system.
  • Systemd Integration: As a core component of the Red Hat ecosystem, Podman integrates seamlessly with systemd for managing container lifecycles.
  • Docker Compatibility: Podman’s command-line interface is an alias for Docker’s, meaning you can use the same commands you already know (podman run instead of docker run) with minimal friction.

Step-by-Step Installation and Configuration

Follow these steps carefully to ensure a smooth setup process. We will install all the necessary tools and configure the system for optimal performance.

Step 1: Update Your System and Install Prerequisites

First, ensure your CentOS Stream 10 system is fully up to date. It’s also a good time to install curl and git, which are essential tools for any developer.

sudo dnf update -y
sudo dnf install -y curl git

Step 2: Install and Configure Podman

CentOS Stream 10 includes Podman in its default repositories, making installation straightforward.

sudo dnf install -y podman

Once installed, it’s a good practice to start the Podman socket, which allows other services (like Minikube) to interact with the Podman API.

systemctl --user enable --now podman.socket

Step 3: Install kubectl

The Kubernetes command-line tool, kubectl, is your primary interface for interacting with any Kubernetes cluster, including the one you’re about to create with Minikube.

We will download the latest stable release directly from the official Kubernetes project.

# Download the latest stable kubectl binary
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

# Make the binary executable
chmod +x ./kubectl

# Move it to a directory in your system's PATH
sudo mv ./kubectl /usr/local/bin/kubectl

Verify the installation by checking the version:

kubectl version --client

Step 4: Install Minikube

Next, we’ll install Minikube itself. Similar to kubectl, we will download the latest binary and place it in our system’s PATH.

# Download the latest Minikube binary for Linux
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64

# Make the binary executable
chmod +x minikube

# Move it to a directory in your system's PATH
sudo mv minikube /usr/local/bin/

You can verify the Minikube installation by checking its version:

minikube version

Step 5: Start Your Local Kubernetes Cluster

With all the components installed, it’s time to start your cluster. This single command tells Minikube to create a new Kubernetes environment using Podman as the container driver.

This is the most important command:

minikube start --driver=podman

Minikube will now download the necessary container images and configure your single-node cluster. This may take a few minutes, especially on the first run.

Once the process is complete, you can check the status of your cluster:

minikube status

You should see output indicating that the host, kubelet, and API server are all running. You can also use kubectl to confirm that your node is ready:

kubectl get nodes

The output should show a single node with the status Ready.

Interacting with Your New Cluster

Congratulations! You now have a fully operational local Kubernetes cluster. Here are a few commands to get you started.

  1. Deploy a Sample Application:
    Let’s create a simple Nginx deployment.

    kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4
    
  2. Expose the Deployment as a Service:
    To access the application, you need to expose it as a service.

    kubectl expose deployment hello-minikube --type=NodePort --port=8080
    
  3. Access the Service:
    Minikube provides a handy command to get the URL for an exposed service.

    minikube service hello-minikube
    

    This command will automatically open the service URL in your default web browser, or you can copy the URL and use curl to test it.

Essential Security and Management Tips

  • Firewall Configuration: If you have firewalld enabled, you might need to add the Podman network interface to the trusted zone to allow communication. First, find the Podman network interface name (often podman0) with ip addr, then run:

    sudo firewall-cmd --zone=trusted --add-interface=podman0 --permanent
    sudo firewall-cmd --reload
    
  • Stopping the Cluster: To save system resources when you’re not using it, you can stop the cluster:

    minikube stop
    
  • Deleting the Cluster: If you want to start fresh or remove the cluster completely, use the delete command. Warning: This will delete all your deployments and data inside the cluster.

    minikube delete
    
  • Accessing the Dashboard: Minikube comes with a web-based Kubernetes Dashboard. You can launch it with:
    bash
    minikube dashboard

By using Minikube with Podman on CentOS Stream 10, you’ve created a modern, secure, and efficient local development environment that closely mirrors production-grade Linux systems. You are now well-equipped to build, test, and deploy containerized applications with confidence.

Source: https://infotechys.com/minikube-with-podman-centos-stream-10/

900*80 ad

      1080*80 ad