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.
We have successfully deployed origin (OKD) in CentOS 7 VM (All in One). You could test and experience the Openshift using this platform.
David Sousa says
Hi I am getting this when I try to bring the cluster up:
[root@oc-master1 ~]# oc cluster up –base-dir=”$HOME/.occluster”
Getting a Docker client …
Checking if image openshift/origin-control-plane:v3.11 is available …
Checking type of volume mount …
Determining server IP …
Checking if OpenShift is already running …
Checking for supported Docker version (=>1.22) …
Checking if insecured registry is configured properly in Docker …
Checking if required ports are available …
Checking if OpenShift client is configured properly …
Checking if image openshift/origin-control-plane:v3.11 is available …
Starting OpenShift using openshift/origin-control-plane:v3.11 …
I0918 18:09:14.749726 6452 config.go:40] Running “create-master-config”
I0918 18:09:16.627384 6452 config.go:46] Running “create-node-config”
I0918 18:09:17.884987 6452 flags.go:30] Running “create-kubelet-flags”
I0918 18:09:18.375541 6452 run_kubelet.go:49] Running “start-kubelet”
I0918 18:09:18.552449 6452 run_self_hosted.go:181] Waiting for the kube-apiserver to be ready …
I0918 18:09:38.566338 6452 interface.go:26] Installing “kube-proxy” …
I0918 18:09:38.566362 6452 interface.go:26] Installing “kube-dns” …
I0918 18:09:38.566370 6452 interface.go:26] Installing “openshift-service-cert-signer-operator” …
I0918 18:09:38.566377 6452 interface.go:26] Installing “openshift-apiserver” …
I0918 18:09:38.566414 6452 apply_template.go:81] Installing “openshift-apiserver”
I0918 18:09:38.566416 6452 apply_template.go:81] Installing “kube-proxy”
I0918 18:09:38.566519 6452 apply_template.go:81] Installing “kube-dns”
I0918 18:09:38.566549 6452 apply_template.go:81] Installing “openshift-service-cert-signer-operator”
I0918 18:09:40.584362 6452 interface.go:41] Finished installing “kube-proxy” “kube-dns” “openshift-service-cert-signer-operator” “openshift-apiserver”
Error: timed out waiting for the condition