Setup OpenShift Origin (OKD) on Ubuntu 20.04/18.04/16.04

Posted on 303 views

How do I install OpenShift Origin on Ubuntu 19.04/18.04/16.04?. OpenShift Origin (OKD) is an Open Source implementation of Red Hat OpenShift. In a nutshell, it is the community distribution of Kubernetes optimized for developing, deploying, and managing container-based applications. Openshift gives you a self-service platform to create, modify, and deploy applications on demand.

If you’re on CentOS, check: How To Setup Local OpenShift Origin (OKD) Cluster on CentOS 7

Similar: How to run Local Openshift Cluster with Minishift

OpenShift aims at ensuring there is faster development and release life cycles. This guide has been written to guide you through the installation of single node OpenShift Origin on Ubuntu 18.04 / 16.04. This setup is not recommended for production use. Refer to Openshift Origin Cluster installation for production use.

Step 1: Install Docker CE on Ubuntu

A single node installation will run all OKD services in docker containers. Docker Engine runtime is required on the host system.

Import Docker GPG key.

curl -fsSL | sudo apt-key add -

Once it is imported, add Docker APT repository to your Ubuntu 18.04 system.

sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

The Docker repository is now added, run the commands below to update system and install Docker CE on Ubuntu.

sudo apt update && sudo apt -y install docker-ce

Verify your Docker Engine installation.

$ docker version
  Version:           18.09.3
  API version:       1.39
  Go version:        go1.10.8
  Git commit:        774a1f4
  Built:             Thu Feb 28 06:53:11 2019
  OS/Arch:           linux/amd64
  Experimental:      false
 Server: Docker Engine - Community
   Version:          18.09.3
   API version:      1.39 (minimum version 1.12)
   Go version:       go1.10.8
   Git commit:       774a1f4
   Built:            Thu Feb 28 05:59:55 2019
   OS/Arch:          linux/amd64
   Experimental:     false

Add your User account to docker group.

sudo usermod -aG docker $USER

Step 2: Download OpenShift Origin on Ubuntu 19.04/18.04/16.04

Download the OpenShift client utility (oc) which is used to bootstrap Openshift Origin on Ubuntu. As of this writing, the most recent release is 3.11.0 .


Uncompress downloaded file.

tar xvf openshift-origin-client-tools*.tar.gz

Switch to created folder and copy kubectl and oc binaries to the /usr/local/bin directory.

cd openshift-origin-client*/
sudo mv  oc kubectl  /usr/local/bin/

Verify installation of OpenShift client utility.

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

Allow use of Insecure Docker registry.

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

Restart Docker service after adding the file.

sudo systemctl restart docker

Start OpenShift Origin All-in-One Server

Start OKD server by running the following command:

$ oc cluster up

The command above will:

  • Start OKD Cluster listening on local interface –
  • Start a web console listening on all interfaces at /console (
  • Launch Kubernetes system components.
  • Provisions registry, router, initial templates, and a default project.

There are a number of options which can be applied when setting up Openshift Origin, view them with:

$ oc cluster up --help

On a successful installation, you should get output similar to below.

Login to server …
Creating initial project "myproject" …
Server Information …
OpenShift server started.
The server is accessible via web console at:
You are logged in as:
     User:     developer
To login as administrator:
     oc login -u system:admin

Example below uses custom options.

$ oc cluster up \

Or Just public/Private IP

oc cluster up --public-hostname=

OpenShift cluster configuration files will be located inside the openshift.local.clusterup/ directory.

To login as administrator, use:

$ oc login -u system:admin
Logged into "" as "system:admin" using existing credentials.
You have access to the following projects and can switch between them with 'oc   project ':
* default
 Using project "default.

Change to the default project:

oc project default

Deploy OKD cluster integrated container image registry if it doesn’t exist.

$ oc adm registry
Docker registry "docker-registry" service exists

Check current project status.

$ oc status
 In project default on server
 svc/docker-registry -
   dc/docker-registry deploys 
     deployment #1 deployed about an hour ago - 1 pod
 svc/kubernetes - -> 8443
 svc/router - ports 80, 443, 1936
   dc/router deploys 
     deployment #1 deployed about an hour ago - 1 pod
 View details with 'oc describe /' or list everything with 'oc get all'.

Creating a Project on OKD

Now that we have OKD installed and working, we can test the deployment by deploying a test project. Switch to test user account.

$ oc login
Authentication required for (openshift)
Username: developer
Password: developer
Login successful.

Confirm if Login was successful.

$ oc whoami

Create a new project using oc new-project command.

$ oc new-project dev --display-name="Project1 - Dev" --description="My Dev Project"

Access Admin Console in a browser

OKD includes a web console which you can use for creation and management actions. This web console is accessible on Server IP/Hostname on the port,8443 via https.


If you are redirected to when trying to access OpenShift web console, then do this:

1. Stop OpenShift Cluster

$ oc cluster down

2. Edit OCP configuration file.

$ nano ./openshift.local.clusterup/openshift-controller-manager/openshift-master.kubeconfig

Locate line “server:“, then replace with:

server: https://serverip:8443

3. Then start cluster:

$ oc cluster up

You should see an OpenShift Origin window with Username and Password forms, similar to this one:


Login with:

Username: developer
Password: developer

You should see a dashboard similar to below.


A Project can be created from the web console.


Give it a name, optional Display Name, and Description. If you click on Project name, you should get to the Project management dashboard where you can Browse Catalog, Deploy Image and Import YAML/JSON.


Status of deployed Project can be viewed from CLI.

$ oc login
$ oc project 
$ oc status
In project My Project (myproject) on server
svc/parksmap-katacoda -
   dc/parksmap-katacoda deploys istag/parksmap-katacoda:1.0.0 
     deployment #1 deployed 4 minutes ago - 1 pod
2 infos identified, use 'oc status --suggest' to see details.

Deploy Test Application on OpenShift Origin

We can now deploy test Application in the cluster.

1. Login to Openshift cluster:

$ oc login 
Authentication required for https:// (openshift)
Username: developer 
Password: developer
Login successful.

You don't have any projects. You can try to create a new project, by running

    oc new-project

2. Create a test project.

$ oc new-project test-project 

3. Tag an application image from Docker Hub registry.

$ oc tag --source=docker openshift/deployment-example:v2 deployment-example:latest 
Tag deployment-example:latest set to openshift/deployment-example:v2.

4. Deploy Application to OpenShift.

$ oc new-app deployment-example 
--> Found image da61bb2 (3 years old) in image stream "test-project/deployment-example" under tag "latest" for "deployment-example"

    * This image will be deployed in deployment config "deployment-example"
    * Port 8080/tcp will be load balanced by service "deployment-example"
      * Other containers can access this service through the hostname "deployment-example"
    * WARNING: Image "test-project/deployment-example:latest" runs as the 'root' user which may not be permitted by your cluster administrator

--> Creating resources ... "deployment-example" created
    service "deployment-example" created
--> Success
    Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
     'oc expose svc/deployment-example'
    Run 'oc status' to view your app.

5. Show Application Deployment status.

$ oc status
In project test-project on server

svc/deployment-example -
  dc/deployment-example deploys istag/deployment-example:latest 
    deployment #1 deployed about a minute ago - 1 pod

2 infos identified, use 'oc status --suggest' to see details.

6. Get service detailed information.

$ oc get svc
NAME                 TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
deployment-example   ClusterIP           8080/TCP   18m

$ oc describe svc deployment-example
Name:              deployment-example
Namespace:         test-project
Labels:            app=deployment-example
Selector:          app=deployment-example,deploymentconfig=deployment-example
Type:              ClusterIP
Port:              8080-tcp  8080/TCP
TargetPort:        8080/TCP
Session Affinity:  None

7. Test App local access.


8. Show Pods status

$ oc get pods
NAME                         READY     STATUS    RESTARTS   AGE
deployment-example-1-vmf7t   1/1       Running   0          21m

9. Allow external access to the application.

$ oc expose service/deployment-example exposed

$ oc get routes
NAME                 HOST/PORT                                                       PATH      SERVICES             PORT       TERMINATION   WILDCARD
deployment-example             deployment-example   8080-tcp                 None

10. Test external access to the application.

Open the URL shown in your browser.


Note that I have Wildcard DNS record for * pointing to OpenShift Origin server IP address and –routing-suffix set to ‘‘ during deployment.

11. Delete test Application

$ oc delete all -l app=deployment-example 
pod "deployment-example-1-8n8sd" deleted
replicationcontroller "deployment-example-1" deleted
service "deployment-example" deleted "deployment-example" deleted "deployment-example" deleted

$ oc get pods
No resources found.

Read OpenShift Origin documentation and stay connected for more updates.


Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.