Requirement for Deploying OCP Cluster on vSphere using IPI: –

vSphere 6.7u3 and later with HW version 15

vCenter User account for the provision of the OpenShift Cluster on vSphere

A minimum of 800 GB of storage is required to use a standard cluster (3 masters, three worker nodes) (You deploy without 800 Gb min storage in the config file. Specify disk type as Thin)

One DHCP Network with Internet access

One Bastion Host for Deploying the OpenShift Container Platform (OCP) Cluster -Linux/mac

Two Static IPs – api VIP, ingress VIP

DNS

OpenShift License (you can try with 60 days Evaluation license)

My Deployment Overview: –

vSphere version – 8.0a

Network – dhcp-vlan15

Bastion host – Cent OS 8 Stream – 172.90.0.29

DNS – Windows – Base Domain name – kdinesh.in, IP – 192.168.5.150

OpenShift version – 4.11

API VIP – 172.100.0.61, Ingress VIP – 172.100.0.62

Deployment Steps: –

  1. Create DNS Records.
  2. Deploy Bastion Host and generate an SSH key
  3. Download OpenShift deployment required installation packages – OpenShift installer, Client, and OpenShift Pull Secret.
  4. Copy the Downloaded file to the bastion host and Extract OpenShift Installation and Command line Tar Files.
  5. Deploy/Install OpenShift Container Platform (OCP) Cluster
  6. Scale Workload nodes
  1. Creating DNS records

Create API VIP and Ingress VIP DNS A/AAAA and PTR Records with Cluster name

api.<cluster_name>.<base_domain>.                               #api.ocp4.kdinesh.in

*.apps.<cluster_name>.<base_domain>.                         #*.apps.ocp4.kdinesh.in

               Check DNS Resolution

2. Deploying Bastion Host and generating an SSH key

Create VM with Cent OS 8 Stream -(You can check the online article on how to create and install cent OS VM ).

Generating SSH Key

ssh-keygen -t ed25519 -N ” -f ~/.ssh/id_ed25519                    # based on Env you can update path and directory

eval “$(ssh-agent -s)”                                                                     # Check SSH-agent Running or not

ssh-add     ~/.ssh/id_ed25519                                                          #Add SSH-Key to agent

3. Downloading OpenShift deployment required installation packages – OpenShift installer, Client, and OpenShift Pull Secret.

Login to OpenShift Portal –  https://console.redhat.com/openshift/install

Select Clusters > Datacenters > Open vSphere

Open Automated option

Select Operating System type, Download OpenShift Installer, OpenShift Command-line Interface, and Pull Secret.

OpenShift cluster deployment required files downloaded

Download the vCenter root certificate (OpenShift Installation required vCenter API access, You must vCenter root certificate to the bastion host trust directory)

4. Copying Downloaded files to bastion host and Extract OpenShift Installation and Command line Tar Files

Copy Downloaded OpenShift Installation, OpenShift Command Line interface, and vCenter root certificate to Bastion host (You can use WinSCP or any other tool to copy downloaded files to the bastion. In case your downloaded files directly on the bastion host, you can ignore this step )

Unzip the vCenter root certificate zip file, Copy the certificate to the Bastion host trust directory (/etc/pki/ca-trust/source/anchors) and update ca-trust.

Unzip download.zip

Cp certs/lin/* /etc/pki/ca-trust/source/anchors

Update-ca-trust extract

Extract the OpenShift installer and OpenShift Client tar file. After extracting the OpenShift Client, Copy kubectl, oc files to the local system bin directory (/usr/local/bin)

tar -xzf openshift-install-linux.tar.gz

tar -xzf openshift-client-linux.tar.gz

cp kubectl oc /usr/local/bin

5. Deploying/Installing OpenShift Container Platform (OCP)

Create new directory

mkdir ocp

Run the following command to generate an OpenShift installation file – install-config  

./openshift-install create install-config –dire /root/ocp

After running the above command – Choose options based on your vSphere infra

SSH Public Key     – Select previously generated SSH key path

Platform – Choose vSphere

              vCenter – Enter vCenter URL

              Username – Enter vCenter Username

              Password – vCenter User Password

              Default datastore – Choose the datastore, where you want to deploy OpenShift cluster nodes

              Network – Choose Network, which network do you want to use for OpenShift Cluster deployment

               Virtual IP Address API – Enter API VIP (Previously in steps-1 already created DNS records)

               Virtual IP Address ingress – Enter ingress VIP

               Base Domain – Enter Your Base Domain name

                Cluster Name – Enter OCP Cluster name (Previously in Step1 created DNS records with clusters name)

                Pull Secret – Paste Download Pull Secret Key

               OpenShift Install-config file generated in ocp directory (You can update generated install-config file based on your requirements.   Ex: –      default cluster nodes will use thick storage, if you want to use thin storage, you need to specify in the install-config file)

               You can check the sample Install-config file – https://github.com/Dineshk1205/OCP-IPI/blob/main/install-config   

Once install-config is Prepared, you can run the following command to create the OpenShift Cluster

./openshift-install create cluster –dir /root/ocp –log-level=info                     (Instead of –log-level=info, you can choose to debug option, it will show the entire deployment flow )

It will take a few minutes. Wait for a few minutes. Once Cluster Is ready.

On Bastion run the following command to check OpenShift Cluster Status

Export kUBECONFIG=/root/ocp/auth/kubeconfig              # specify OpenShift installer path

Kubectl get nodes

Cluster nodes are up, Login to OpenShift Console (You can check the URL using the command – Kubectl get routes -n openshift-console)

Default username – kubeadmin

Password – You can find in the OpenShift installation directory – auth – kubeadmin-password  

In OpenShift Console You can check a number of masters, and worker nodes’ statuses.

You can also check on vCenter 6 VMs running, Three Masters and Three Workers

6. Scale Workload nodes

In OpenShift Console > Select MachineSets > Click on three dots

Select Edit Machine count

Change machine count from 3 to 4. Automatically 4th node will be provisioned and integrated with existing cluster nodes.

You can also check in vCenter New Worker node VM provisioned

Using the MachineSets option you can scale up/down nodes