How to install OpenShift Origin on Ubuntu 18.04

Install a powerhouse tool that can help you develop, deploy, and manage container-based applications.

How to install OpenShift Origin on Ubuntu 18.04 Install a powerhouse tool that can help you develop, deploy, and manage container-based applications.

OpenShift Origin is an open source implementation of Red Hat's OpenShift. For those that have yet to experience OpenShift, it is a community distribution of Kubernetes that is optimized for developing, deploying, and managing container-based applications, all of which can happen on-demand.

One of the biggest advantages of OpenShift Origin is that it enables faster development and release cycles for applications.

I want to walk you through the process of installing OpenShift Origin on Ubuntu 18.04. The purpose of this how-to is so that you can get a single OpenShift Origin node up and running. With this instance, you can kick the tires of this technology, to see if it suits your company's needs. Once you've made the decision to deploy OpenShift on a production level, you can then make the leap to deploying a cluster. Before that, however, you must know how to get a single node up and running.

Let's do just that.

SEE: Hybrid cloud: A guide for IT pros (TechRepublic download)

What you'll need

All you will need to make this work is a running instance of Ubuntu Server 18.04 and a user account with sudo privileges.

With those two bits at the ready, let's install.

How to install Docker CE

The first thing to do is install the Docker engine. To do this, open a terminal window and issue the following commands:

  • Import the Docker GPG key with the command curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  • Add the necessary repository with the command sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  • Update and install with the command sudo apt update && sudo apt -y install docker-ce

Once Docker is installed, you need to add your user to the docker group. This is done with the command:

sudo usermod -aG docker $USER

After issuing the above command, log out and log back in so the changes will take effect. 

How to download OpenShift

First we need to download the latest OpenShift Origin file. As of this writing, that version number is 3.11.0. Go back to the terminal window and issue the command:

wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz

Once the file is downloaded, extract it with the command:

tar xvzf openshift*.tar.gz

Change into the newly-created directory with the command:

cd openshift-origin-client-tools*/

Move the kubectl and oc binaries with the command:

sudo mv  oc kubectl  /usr/local/bin/

Finally, make sure you can run the oc command with:

oc version

The command should report back:

oc v3.11.0+0cbc58b
kubernetes v1.11.0+d4cacc0
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://127.0.0.1:8443
kubernetes v1.11.0+d4cacc0

You're ready to continue on.

Insecure registry and starting the cluster

Before taking your first steps with OpenShift Origin, you need to configure it such that it can use an insecure registry. To do this, issue the command:

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

Restart Docker with the command:

sudo systemctl restart docker

You can now start the server with the command:

oc cluster up

After the cluster is up, bring it back down with the command:

oc cluster down

Once that command completes, you need to then configure a file so that OC doesn't constantly redirect from your hosting server IP address to 127.0.0.1. To do this, open the config file with the command:

sudo nano ./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://SERVER_IP:8443

Where SERVER_IP is the IP address of the hosting server.

Save and close the file. Bring the cluster back up with the command:

oc cluster up --public-hostname=SERVER_IP

Where SERVER_IP is the IP address of the hosting server.

How to log in 

Let's start with the command line interface for OpenShift Origin. To log on as a standard user, issue the command:

oc login -u USERNAME -p PASSWORD

Where USERNAME is a valid username on the server and PASSWORD is the password for said user. 

To log on as the administrator, issue the command:

oc login -u system:admin

When you login as the system admin, you will have access to built-in projects, and can easily switch between them (Figure A).

Figure A

origina.jpg

Logged in as the administrator.

Switch to the default project with the command:

oc project default

Change to the developer user with the command:

oc login

At the login prompt type developer for both the username and password.

Create your first project with the command:

oc new-project dev --display-name="Test Project" --description="My Test Project"

Logging Into the Web GUI

Now point your browser to https://SERVER_IP:8443/console. Log in with the credentials developer/developer. You should now find yourself on the OpenShift Origin dashboard (Figure B).

Figure B

originc.jpg

The OpenShift Origin dashboard.

Redirect caveat

If you find you keep getting redirected to https://127.0.0.1:8443, you can get around that by creating an SSH tunnel with the command:

sudo ssh -L 8443:localhost:8443 -f -N USER@SERVER_IP

Where USER is a remote username and SERVER_IP is the IP address on the hosting server. Now you should be able to point your browser to the Web GUI and not be constantly redirected to the localhost address.

You are now ready to start using the OpenShift Origin web-based GUI to develop, deploy, and manage container-based applications.

Also see

originhero.jpg

Image: Jack Wallen