How to Install OpenShift on an On-Prem Server Using Red Hat Enterprise Linux (RHEL): Step-by-Step Guide

Introduction
OpenShift is a powerful Kubernetes-based platform designed to accelerate the development, deployment, and management of containerized applications. Built by Red Hat, it provides developers with self-service capabilities while giving IT teams the tools to ensure security, compliance, and operational efficiency.

Organizations can use OpenShift for:

  • Developing modern applications with built-in CI/CD pipelines.
  • Streamlining DevOps workflows by standardizing Kubernetes-based infrastructure.
  • Managing hybrid or multi-cloud environments with ease and scalability.

If you’re looking to deploy OpenShift on-premises using Red Hat Enterprise Linux, follow the steps below to set up your cluster.


Prerequisites

  1. Hardware Requirements (minimum):

    • Control Plane (Master): 4 CPUs, 16GB RAM, 120GB storage.
    • Worker Nodes: 2 CPUs, 8GB RAM, 120GB storage per node.
  2. Software Requirements:

    • RHEL 8.x installed on all nodes.
    • SSH access to all servers.
    • A wildcard DNS configured for OpenShift routes (e.g., *.apps.your-domain.com).
  3. Download OpenShift Components:

  4. Networking Requirements:

    • Open ports: 443, 6443, and 22623 on all nodes.

Step 1: Prepare RHEL on All Nodes

  1. Update Your System:
    Ensure all nodes are running the latest updates.

    sudo dnf update -y
    
  2. Install Required Packages:

    sudo dnf install -y wget git vim net-tools bind-utils iptables-services \
    bash-completion chrony podman
    
  3. Enable NTP for Time Synchronization:

    sudo systemctl enable --now chronyd
    
  4. Disable Swap (required for Kubernetes):

    sudo swapoff -a
    sudo sed -i '/swap/d' /etc/fstab
    
  5. Enable Kernel Modules:

    sudo modprobe overlay
    sudo modprobe br_netfilter
    echo 'overlay' | sudo tee -a /etc/modules-load.d/overlay.conf
    echo 'br_netfilter' | sudo tee -a /etc/modules-load.d/br_netfilter.conf
    
  6. Configure Firewall Rules:

    sudo firewall-cmd --permanent --add-port=6443/tcp
    sudo firewall-cmd --permanent --add-port=22623/tcp
    sudo firewall-cmd --permanent --add-port=443/tcp
    sudo firewall-cmd --reload
    

Step 2: Set Up the OpenShift Installer

  1. Download and Extract the Installer:

    wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-install-linux.tar.gz
    tar -xvf openshift-install-linux.tar.gz -C /usr/local/bin
    
  2. Verify the Installation:

    openshift-install version
    

Step 3: Generate the Configuration

  1. Create the install-config.yaml File:
    Run the following command:

    openshift-install create install-config
    

    You will need to provide:

    • Cluster name.
    • Base domain.
    • Your pull secret.
    • SSH public key for node access.
  2. Edit Configuration (Optional):
    Customize install-config.yaml to adjust networking, storage, or machine sets.


Step 4: Deploy the Cluster

  1. Start Installation:
    Run the following command to begin deploying your OpenShift cluster:

    openshift-install create cluster
    

    This process will install the control plane and worker nodes.

  2. Monitor Progress:
    The installer will provide real-time updates. Logs are stored at /var/log/openshift-install.log.


Step 5: Access Your OpenShift Cluster

  1. Retrieve the Administrator Credentials:

    cat ./auth/kubeadmin-password
    
  2. Open the OpenShift Console:
    Navigate to:

    https://<api.cluster-name.domain>:6443
    

    Log in using the kubeadmin user and the password from the previous step.


Step 6: Verify Your Cluster

  1. Check Node Status:

    oc get nodes
    
  2. Verify Pod Deployments:

    oc get pods -n openshift-*
    

Troubleshooting Tips

  • DNS Issues: Use dig or nslookup to confirm DNS records.
  • Firewall Configuration: Ensure required ports are open between nodes.
  • Logs: Check logs at /var/log/openshift-install.log for detailed error messages.

With OpenShift running on RHEL, you’re ready to deliver containerized workloads with enterprise-grade reliability and efficiency. Have any questions or need help? Drop them in the comments!