Install OpenShift Origin on AWS EC2 Ubuntu 18.04

BalaSubramani K
KUBELANCER PRIVATE LIMITED
3 min readJun 6, 2021

In this blog, we going to install openshift origin.OpenShift Origin is an open source container application platform created by Red Hat, based on kubernetes and Docker. That means you can host your own PaaS for free and almost with no hassle.

openshift origin install on AWS cloud

Environment:

Cloud: AWSAMI: ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server
Instance type: t2.medium
VPC: defaultSecurity groups :

Inbound Rules

80 TCP 0.0.0.0/0
22 TCP 0.0.0.0/0
8443 TCP 0.0.0.0/0
443 TCP 0.0.0.0/0

1. Install Docker

$ sudo apt-get update

$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

$ sudo apt-key fingerprint 0EBFCD88



$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io


$ sudo usermod -aG docker $USER
(Remember to log out and back in for this to take effect!)

2. Install openshift origin client tool

$ sudo wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz$ sudo tar -xvzf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz$ cd openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit/$ sudo mv oc kubectl /usr/local/bin/

3. Login as root

To add insecure docker registry entry,

$ sudo su -

Run below command as root user, copy all lines and run

cat << EOF > /etc/docker/daemon.json
{
"insecure-registries" : [ "172.30.0.0/16" ]
}
EOF

Restart Docker service

systemctl restart docker

4. Add DNS A records

Next we going to create DNS records to access OpenShift Console in public via web browser.

I have added below record in my AWS Route53

DNS record

18.116.235.174 is my EC2 machine public IP address

5. Set Hostname

To set hostname for ubuntu machine, run below command

sudo hostnamectl set-hostname server1.openshiftorigin.kubelancer.net

6. Start OpenShift Cluster

Login as ubuntu user and run below command to start cluster

sudo oc cluster up --routing-suffix=openshiftorigin.kubelancer.net --public-hostname=server1.openshiftorigin.kubelancer.net

Output

OpenShift server started.

The server is accessible via web console at:
https://server1.openshiftorigin.kubelancer.net:8443

You are logged in as:
User: developer
Password: <any value>

To login as administrator:
oc login -u system:admin

To fix URL redirect issue, follow

Error / Workaround

Bring down openshift cluster

$ sudo oc cluster down

Modify openshift-master.kubeconfig file as below

$ sudo vi ./openshift.local.clusterup/openshift-controller-manager/openshift-master.kubeconfig


In that file, search for the line:

server: https://127.0.0.1:8443

Replace that line with:

server: https://server1.openshiftorigin.kubelancer.net:8443

Save and close the file.

Bring the cluster back up with the command:

$ sudo oc cluster up --routing-suffix=openshiftorigin.kubelancer.net --public-hostname=server1.openshiftorigin.kubelancer.net

Access OpenShift Console

The server is accessible via web console at:

https://server1.openshiftorigin.kubelancer.net:8443

Login as

You are logged in as:
User: developer
Password: <any value>

To login as administrator:
oc login -u system:admin

That’s it.

* * * * * Happy Computing * * * * *

--

--

BalaSubramani K
KUBELANCER PRIVATE LIMITED

Senior Cloud and DevOps Infrastructure Engineer | Multi-Cloud Solution Architect | Consultant | Containerization | Cloud Native | Mobile | Serverless