OpenShift Installation Methods - Examples

Gini Gini Follow · 13 mins read
Share this

1. Installing an OKD 4.x Cluster

Reference Installing an OKD 4.5 Cluster

2. Install OpenShift 4.x

How to install OpenShift 4 on Bare Metal - (UPI) (Video)

3. Method I - Setup an OpenShift All-In-One

3.1. Install required packages

yum install ansible docker wget -y
systemctl enable docker
systemctl start docker

3.2. Disable Firewall

Or you have to open required ports.

systemctl disable firewalld
systemctl stop firewalld

3.3. Installing OpenShift CLI

3.3.1. Method 1 - Standard CentOS repositories

yum -y install centos-release-openshift-origin39
yum -y install origin-clients

3.3.2. Method 2 - Download and extract openshift origin

Create a directory for data (anywhere)

mkdir /data
cd /data

Check the latest version if you need.

wget ""
tar -xzvf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz 
cd openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit Add the directory you untarred the release into to your path:

export PATH=$PATH:/data/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit/

# or

export PATH=$PATH:`pwd`

3.4. Configure the Docker daemon with an insecure registry parameter of

cat > /etc/docker/daemon.json <<DELIM
   "insecure-registries": [

3.4.1. Restart docker service

service docker restart

3.5. Initiate cluster

oc cluster up --base-dir="/data/clusterup" --public-hostname=<IP>
  • --base-dir=BASE_DIR : Directory on Docker host for cluster up configuration

(oc cluster up –public-hostname= – openshift.local.clusterup/openshift-controller-manager/openshift-master.kubeconfig

3.5.1. Ref:


3.5.2. Add a user

# oc create user redhat created
# oc adm policy add-cluster-role-to-user cluster-admin redhat
cluster role "cluster-admin" added: "redhat"

4. Method II - Setup minishift

4.1. Setup Virtual Environment

4.2. Install minishift

  • Download and manually install minishift.
  • On mac brew cask install minishift (in case of issue to install, try export HOMEBREW_NO_ENV_FILTERING=1)

4.3. Start minishift cluster

minishift start --vm-driver virtualbox

## setup VirtualBox Permanently
minishift config set vm-driver virtualbox

Once started, access the console using url or open in browser

minishift console

Setup oc access

$ minishift oc-env
export PATH="/home/john/.minishift/cache/oc/v1.5.0:$PATH"

## Run this command to configure your shell:
# eval $(minishift oc-env)

5. Method III - OpenShift 4 - OKD - All in One Quick Cluster

6. Method IV - OpenShift Full Cluster

7. CodeReady Containers - CRC (OpenShift 4.x)

Red Hat CodeReady Containers


7.1. Download CRC Package

Refer : Install OpenShift on a laptop with CodeReady Containers

  • Visit
  • Choose install on Laptop ->
  • Download for your OS choise (Windows10, MacOS, Linux)
  • Move package to your machine folder
  • extract the package tar -xf FILENAME.tar.xz

  • Download and keep the pull secret from same location. You need that later during crc start

7.2. Required software packages

CodeReady Containers requires the libvirt and NetworkManager packages.

yum install NetworkManager

7.2.1. Enable sudo for user

[devops@node1 ~]$ sudo cat /etc/sudoers.d/devops
[sudo] password for devops:

7.3. Setup Cluster

$ cd crc-linux-1.11.0-amd64
$ export PATH=/home/devops/crc-linux-1.11.0-amd64:$PATH

## set up your host operating system for the CodeReady Containers virtual machine.
## Use normal user account
$ crc setup

## Start cluster
## if you are on a terminal without GUI, you will have difficulty to copy/paste pull secret content. in that you can mention the pull secret ful
$ crc start -p /path-to/pull-secret

7.4. Access your Cluster

$ eval $(crc oc-env)
$ oc login -u developer -p developer

## see credentials
$ crc console --credentials
To login as a regular user, run 'oc login -u developer -p developer https://api.crc.testing:6443'.
To login as an admin, run 'oc login -u kubeadmin -p 8rynV-SeYLc-h8Ij7-YPYcz https://api.crc.testing:6443'

## Access Console
$ crc console
Opening the OpenShift Web Console in the default browser...

7.5. Troubleshooting

7.5.1. After crc start and crc console, oc login fails with Internal error occurred: unexpected response: 503 for a while #740

7.5.2. Unable to connect to console

$ crc ip
$ nmcli conn show

8. OpenSHift 4.x

Create clouds.yaml

      project_name: ocp4-dev
      username: ocpadmin
      password: ocpadmin
    region_name: RegionOne

9. OpenShift 4.2 Installation

10. Red Hat OpenShift 4.x Installation (Evaluation)

10.1. Baremetal Installation

11. OpenShift on Baremetal (UPI)

12. OpenShift All-In-One - OKD Using Ansible


13. Extras OpenSHift 4.x

Create clouds.yaml

      project_name: ocp4-dev
      username: ocpadmin
      password: ocpadmin
    region_name: RegionOne

13.1. OpenShift 4.2 Installation

13.2. OpenShift 4.1 Installation

13.3. Baremetal Installation


14. baremetal

15. Deploy OpenShift Using OpenShift Installer (AWS)

(27 Jan 2021)

Installer configures entire cloud infrastructure:

  • VMs
  • Load balancers
  • Storage
  • Networking
  • Other resources

15.1. Using OpenShift Installer

openshift-install create cluster --dir=$HOME/mycluster

Installer prompts for

  • SSH public key
  • Platform: aws
  • Region: Default in AWS is us-east-1
  • Base domain: Public route 53 domain, needs to exist prior to installation
  • Cluster name: Must be unique within AWS account
  • Pull secret: From Get Started with OpenShift as single-line JSON

Setup Bastion Host

  • Create a bastion node and login to the host.
$ ssh user@bastion-host
$ echo $GUID

Configure Bastion VM to Run OpenShift Installer

Install AWS CLI

# Download the latest AWS Command Line Interface
curl "" -o ""

# Install the AWS CLI into /bin/aws
./awscli-bundle/install -i /usr/local/aws -b /bin/aws

# Validate that the AWS CLI works
aws --version

# Clean up downloaded files
rm -rf /root/awscli-bundle /root/

Download OpenShift Installation Binary

tar zxvf openshift-install-linux-${OCP_VERSION}.tar.gz -C /usr/bin
rm -f openshift-install-linux-${OCP_VERSION}.tar.gz /usr/bin/
chmod +x /usr/bin/openshift-install

Download and Install OC CLI

tar zxvf openshift-client-linux-${OCP_VERSION}.tar.gz -C /usr/bin
rm -f openshift-client-linux-${OCP_VERSION}.tar.gz /usr/bin/
chmod +x /usr/bin/oc
  • Check that the OpenShift installer and CLI are in /usr/bin:
ls -l /usr/bin/{oc,openshift-install}

# Setup auto-completion
oc completion bash >/etc/bash_completion.d/openshift
  • logout from root

Configure AWS CLI Credential

export REGION=us-east-2

mkdir $HOME/.aws
cat << EOF >>  $HOME/.aws/credentials
aws_access_key_id = ${AWSKEY}
aws_secret_access_key = ${AWSSECRETKEY}
region = $REGION

# test AWS Access
aws sts get-caller-identity
  • Open and select “Try it in the Cloud”, Select AWS
  • Choose “Installer-Provisioned-Infrastructure”
  • Copy the Pull Secret (save to file for copy)

  • Create an ssh key pair
ssh-keygen -f ~/.ssh/cluster-${GUID}-key -N ''

Install OpenShift Container Platform

  • Installer will generate Ignition configs for the bootstrap, master, and worker machines.
  • The process for bootstrapping a cluster looks like the following:
    • The bootstrap machine boots and starts hosting the remote resources required for the master machines to boot.
    • The master machines fetch the remote resources from the bootstrap machine and finish booting.
    • The master machines use the bootstrap node to form an etcd cluster.
    • The bootstrap node starts a temporary Kubernetes control plane using the newly created etcd cluster.
    • The temporary control plane schedules the production control plane to the master machines.
    • The temporary control plane shuts down, yielding to the production control plane.
    • The bootstrap node injects OpenShift-specific components into the newly formed control plane.
    • The installer then tears down the bootstrap node.
  • The result of this bootstrapping process is a fully running OpenShift cluster. The cluster will then download and configure the remaining components needed for day-to-day operation, including the creation of worker machines on supported platforms.

Run OpenShift Installer

Run the OpenShift installer and answer the prompts:

  • Select your Public Key (which you have created earlier)
  • Select aws as the Platform.
  • Select any Region near you.
  • Select as the Base Domain.
  • For the Cluster Name, type cluster-101 (or any other name)
  • When prompted, paste the contents of your Pull Secret in JSON format. Do not include any spaces or white characters and make sure it is in one line
$ openshift-install create cluster --dir $HOME/cluster-101

# Sample answers
? SSH Public Key /home/user/.ssh/
? Platform aws
INFO Credentials loaded from the "default" profile in file "/home/user/.aws/credentials"
? Region us-east-2 (Ohio)
? Base Domain
? Cluster Name cluster-101
? Pull Secret [? for help] ***************************************************************************************************************************************************************

# wait for installer to finish

INFO Creating infrastructure resources...
INFO Waiting up to 20m0s for the Kubernetes API at 
INFO API v1.19.0+9f84db3 up
INFO Waiting up to 30m0s for bootstrapping to complete...
INFO Destroying the bootstrap resources...        
INFO Waiting up to 40m0s for the cluster at to initialize... 
INFO Waiting up to 10m0s for the openshift-console route to be created... 
INFO Install complete!
INFO To access the cluster as the system:admin user when using 'oc', run 'export KUBECONFIG=/home/gineesh.madapparambath-fujitsu.c/cluster-d0ce/auth/kubeconfig'
INFO Access the OpenShift web-console here:
INFO Login to the console with user: "kubeadmin", and password: "6TVYn-33gLY-7ZjrA-eqRQE" 
INFO Time elapsed: 37m56s
  • Make note of the following items from the output of the install command:
    • The location of the kubeconfig file, which is required for setting the KUBECONFIG environment variable and, as suggested, sets the OpenShift user ID to system:admin.
    • The kubeadmin user ID and associated password (GEveR-tBVTB-jJUJB-iC9Jn in the example).
    • The password for the kubeadmin user is also written into the auth/kubeadmin-password file.
    • The URL of the web console - ( in the example) and the credentials (again) to log into the web console.
  • Refer ${HOME}/cluster-101/.openshift_install.log for logs and troubleshooting.

multi-step installation.

# Create the installation configuration: 
openshift-install create install-config --dir $HOME/cluster-${GUID}.

# Update the generated install-config.yaml file—for example, change the AWS EC2 instance types.

# Create the YAML manifest templates: 
openshift-install create manifests --dir $HOME/cluster-${GUID}.
#  Changing the manifest templates is unsupported.

# Create the YAML manifests:
openshift-install create manifests --dir $HOME/cluster-${GUID}
#  Changing the manifests is unsupported.

# Create the Ignition configuration files: 
openshift-install create ignition-configs --dir $HOME/cluster-${GUID}.
# Changing the Ignition configuration files is unsupported.

# Install the cluster: 
openshift-install create cluster --dir $HOME/cluster-${GUID}.

# To delete the cluster, use: 
openshift-install destroy cluster --dir $HOME/cluster-${GUID}.

Clean Up Cluster

openshift-install destroy cluster --dir $HOME/cluster-${GUID}

# Delete all of the files created by the OpenShift installer:
rm -rf $HOME/.kube
rm -rf $HOME/cluster-${GUID}

Validate Cluster

# Setup CLI
export KUBECONFIG=$HOME/cluster-${GUID}/auth/kubeconfig
echo "export KUBECONFIG=$HOME/cluster-${GUID}/auth/kubeconfig" >>$HOME/.bashrc

$ oc whoami

# get console and login with kubeadmin & password from installation log
$ oc whoami --show-console


Written by Gini Follow
Backpacker, Foodie, Techie

Latest Stories

How To Get Hands-On Experience in AWS

Every Time you have the same situation, you know the technology and maybe you are already a certified professional in that technology, but you are not getting enough hands-on on that ...

In AWS, Jan 04, 2021
Getting Started with Ansible Collections

Ansible Collection is a great way of getting content contributions from various Ansible Developers. Earlier there was a tagline for Ansible – “Batteries included”, but now the battery...

In redhat, ansible, Dec 22, 2020
Configure Your Windows Host to be Managed by Ansible

I was talking to my friend about Ansible automation and how we are implementing automated solutions for cloud and on-premise infrastructure. Then he told me that, his team is looking ...

In redhat, ansible, Dec 01, 2020
Remove nodes from Kubespray Managed Kubernetes Cluster

Kubespray is a combination of Ansible and Kubernetes and you can use Kubespray for deploying production ready Kubernetes clusters. You can manage full-lifecycle of Kubernetes clusters...

In containers, kubernetes, Nov 30, 2020
Adding new nodes to Kubespray Managed Kubernetes Cluster

Kubespray is a combination of Ansible and Kubernetes and you can use Kubespray for deploying production ready Kubernetes clusters. Learn how to add new nodes in a Kubernetes cluster u...

In containers, kubernetes, Nov 27, 2020