Site icon UnixArena

Origin (OpenShift) Deployment in VM – All in One for LAB

How to Deploy Openshift in VM quickly? Is it possible to configure all the Openshift components in one node? How to experience the real Openshift web UI? Openshift is one of the Kubernetes’s variants and it’s developed and supported by Redhat. Origin is an upstream open source project to experience and test Openshift. This article will walk you through how to deploy Origin (OKD) on CentOS 7. OKD (Origin Community Distribution) has multiple installation methods available and running in a Container is one of the methods. We will deploy OKD in a container format.

 

Environment: CentOS 7

Repository : EPEL  & Basic CentOS Repository

 

Prerequisites :

1. Disable SELIUNX .

 

2. Disable Firewalld. (Since we are deploying Openshift for LAB )

 

3. Install the docker engine.

[root@origin-aio yum.repos.d]# yum install docker
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                              | 5.1 kB  00:00:00
 * base: centos.myfahim.com
 * epel: mirror.horizon.vn
 * extras: centos.myfahim.com
 * updates: centos.myfahim.com

 

Here are the installed docker packages.

[root@origin-aio yum.repos.d]# rpm -qa |grep -i docker
docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64
docker-client-1.13.1-96.gitb2f74b2.el7.centos.x86_64
docker-1.13.1-96.gitb2f74b2.el7.centos.x86_64
[root@origin-aio yum.repos.d]#

 

4. start the docker service and enable it to start at boot.

[root@origin-aio ~]# systemctl start docker
[root@origin-aio ~]# systemctl enable  docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@origin-aio ~]#

 

If you get below error during the Openshift, it’s most likely that docker service is not running.

—————————————————————————————————–
— Checking OpenShift client … OK
— Checking Docker client … FAIL
Error: cannot communicate with Docker 

Solution:
Ensure that Docker is installed and accessible in your environment.
Use your package manager or follow instructions at:
https://docs.docker.com/linux/

Caused By:
Error: cannot connect to Docker endpoint

—————————————————————————————————–

 

Download oc binary.  

1. Download oc binary.  Refer: https://www.okd.io/download.html 

[root@origin-aio ~]# wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
--2019-06-03 08:22:45--  https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
Resolving github.com (github.com)... 140.82.118.3
Connecting to github.com (github.com)|140.82.118.3|:443... connected.

 

2. Extract the files.

[root@origin-aio ~]# ls -lrt
total 65456
-rw-r--r--.  1 root root 56507103 Oct 11  2018 openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
[root@origin-aio ~]# gunzip openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
[root@origin-aio ~]# ls -lrt
total 245368
-rw-r--r--.  1 root root 240735744 Oct 11  2018 openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar
[root@origin-aio ~]# tar -xf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar
[root@origin-aio ~]# cd openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit
[root@origin-aio openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit]# ls -lrt
total 235092
-rwxrwxr-x. 1 root root 120350344 Oct 10  2018 oc
-rwxrwxr-x. 1 root root 120350344 Oct 10  2018 kubectl
-rw-rwxr--. 1 root root     15834 Oct 10  2018 README.md
-rw-rwxr--. 1 root root     10759 Oct 10  2018 LICENSE
[root@origin-aio openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit]# 

 

3. Move the binaries to command search path.

[root@origin-aio openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit]# mv o* k* /usr/local/sbin/
[root@origin-aio openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit]# ls -lrt /usr/local/sbin/oc
-rwxrwxr-x. 1 root root 120350344 Oct 10  2018 /usr/local/sbin/oc
[root@origin-aio openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit]# ls -lrt /usr/local/sbin/kubectl
-rwxrwxr-x. 1 root root 120350344 Oct 10  2018 /usr/local/sbin/kubectl
[root@origin-aio openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit]# 

 

Deploying origin cluster on CentOS7: 

1. Deploy the Openshift cluster (Origin) or OKD using oc binary.

[root@origin-aio ~]# oc cluster up
-- Checking OpenShift client ... OK
-- Checking Docker client ... OK
-- Checking Docker version ... OK
-- Checking for existing OpenShift container ... OK
-- Checking for openshift/origin:v1.4.1 image ...
   Pulling image openshift/origin:v1.4.1
   Pulled 0/3 layers, 3% complete
   Pulled 0/3 layers, 30% complete
   Pulled 0/3 layers, 55% complete
   Pulled 1/3 layers, 75% complete
   Pulled 2/3 layers, 92% complete
   Pulled 3/3 layers, 100% complete
   Extracting
   Image pull complete
-- Checking Docker daemon configuration ... FAIL
   Error: did not detect an --insecure-registry argument on the Docker daemon
   Solution:

     Ensure that the Docker daemon is running with the following argument:
        --insecure-registry 172.30.0.0/16

 

Origin cluster deployment failed due to the secure registry.

Error: did not detect an –insecure-registry argument on the Docker daemon
Solution:

Ensure that the Docker daemon is running with the following argument:
–insecure-registry 172.30.0.0/16

 

2. To fix the above error, please update docker’s daemon.json file like below. You must restart docker daemon.

[root@origin-aio ~]# cat /etc/docker/daemon.json
{
"insecure-registry" : [ "172.30.0.0/16" ]
}
[root@origin-aio ~]#

 

3. Restart docker daemon to take effect.

[root@origin-aio ~]# systemctl restart docker

 

4. Re-run the origin (OKD) deployment.

[root@origin-aio ~]# oc cluster up
-- Checking OpenShift client ... OK
-- Checking Docker client ... OK
-- Checking Docker version ... OK
-- Checking for existing OpenShift container ... OK
-- Checking for openshift/origin:v1.4.1 image ... OK
-- Checking Docker daemon configuration ... OK
-- Checking for available ports ... OK
-- Checking type of volume mount ...
   Using nsenter mounter for OpenShift volumes
-- Creating host directories ... OK
-- Finding server IP ...
   Using 192.168.2.39 as the server IP
-- Starting OpenShift container ...
   Creating initial OpenShift configuration
   Starting OpenShift using container 'origin'
   Waiting for API server to start listening
   OpenShift server started
-- Adding default OAuthClient redirect URIs ... OK
-- Installing registry ... OK
-- Installing router ... OK
-- Importing image streams ... OK
-- Importing templates ... OK
-- Login to server ... OK
-- Creating initial project "myproject" ... OK
-- Removing temporary directory ... OK
-- Server Information ...
   OpenShift server started.
   The server is accessible via web console at:
       https://192.168.2.39:8443

   You are logged in as:
       User:     developer
       Password: developer

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

[root@origin-aio ~]#

 

5. Login to the Origin Web UI to test the Openshift deployment.

Openshift origin Deployment – Lab

 

We have successfully deployed origin (OKD) in CentOS 7 VM  (All in One). You could test and experience the Openshift using this platform.

Exit mobile version