Install Red Hat OpenShift on CentOS Stream 9/10

This guide provides a step-by-step installation of Red Hat OpenShift Container Platform (OCP) on CentOS Stream 9 or CentOS Stream 10 using User Provisioned Infrastructure (UPI).

1. Prerequisites


- CentOS Stream 9 or CentOS Stream 10 servers
- Minimum 16 GB RAM per node
- Minimum 4 vCPU per node
- Static IP addresses
- Proper DNS configuration
- Load Balancer configured
- Internet connectivity
- SSH access enabled
- SELinux enabled

2. Set Hostname


sudo hostnamectl set-hostname master1.ocp.example.com

3. Configure /etc/hosts


sudo vi /etc/hosts

# Add:
192.168.1.10 api.ocp.example.com
192.168.1.11 master1.ocp.example.com
192.168.1.12 master2.ocp.example.com
192.168.1.13 master3.ocp.example.com
192.168.1.21 worker1.ocp.example.com
192.168.1.22 worker2.ocp.example.com

4. Update System Packages


sudo dnf update -y

sudo reboot

5. Install Required Packages


sudo dnf install -y \
wget \
curl \
git \
vim \
jq \
tar \
podman \
bind-utils \
net-tools

6. Disable Swap


sudo swapoff -a

sudo sed -i '/swap/d' /etc/fstab

7. Configure SELinux


sudo setenforce 1

sestatus

8. Configure Firewall


sudo firewall-cmd --permanent --add-port=6443/tcp

sudo firewall-cmd --permanent --add-port=22623/tcp

sudo firewall-cmd --permanent --add-service=http

sudo firewall-cmd --permanent --add-service=https

sudo firewall-cmd --reload

9. Install Container Tools


sudo dnf install -y podman buildah skopeo

10. Download OpenShift Installer


wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-install-linux.tar.gz

tar -xvf openshift-install-linux.tar.gz

sudo mv openshift-install /usr/local/bin/

11. Download OpenShift Client Tools


wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux.tar.gz

tar -xvf openshift-client-linux.tar.gz

sudo mv oc kubectl /usr/local/bin/

12. Verify OpenShift Tools


openshift-install version

oc version

kubectl version --client

13. Create Installation Directory


mkdir ~/openshift-install

cd ~/openshift-install

14. Generate SSH Key


ssh-keygen -t rsa -b 4096

cat ~/.ssh/id_rsa.pub

15. Generate Install Configuration


openshift-install create install-config

16. Create OpenShift Cluster


openshift-install create cluster \
--dir=~/openshift-install \
--log-level=info

17. Access OpenShift Web Console


https://console-openshift-console.apps.ocp.example.com

18. Login Using OC CLI


oc login -u kubeadmin -p  \
https://api.ocp.example.com:6443

19. Verify Cluster Health


oc get nodes

oc get pods -A

oc cluster-info

20. Optional Post Installation Tasks


- Configure Storage Classes
- Configure Monitoring
- Install Operators
- Configure Logging
- Configure Authentication
- Create Projects and Users