Run Open Source Openshift OKD on Windows 10 Home with Oracle Virtual Box

Views: 5454

Develop On Openshift on your Windows 10 Laptop

As part of our Work we install and configure Openshift. We offer full solutions from installation through the Devops pipeline.

I have found that using minishift with VirtualBox to be the easiest Proof of Concept as well as the ability to develop applications and Infrastructure as a service. I found it easiest to fiddle with OKD to be able to simply create projects for R & D.

Install Oracle Virtual box

Download Minishift

https://docs.okd.io/latest/minishift/getting-started/preparing-to-install.html

download the Windows AMD 64 latest, It works with Intel also, from https://github.com/minishift/minishift/releases

Now run the minishift with your previously installed VirtualBox

Run:

.\minishift start –vm-driver=virtualbox

You Should see output similar to the following:

PS C:\Users\Steve\Downloads\minishift-1.34.0-windows-amd64\minishift-1.34.0-windows-amd64> .\minishift start –vm-driver=virtualbox
— Starting profile ‘minishift’
— Check if deprecated options are used … OK
— Checking if https://github.com is reachable … OK
— Checking if requested OpenShift version ‘v3.11.0’ is valid … OK
— Checking if requested OpenShift version ‘v3.11.0’ is supported … OK
— Checking if requested hypervisor ‘virtualbox’ is supported on this platform … OK
— Checking if VirtualBox is installed … OK
— Checking the ISO URL … OK
— Checking if provided oc flags are supported … OK
— Starting the OpenShift cluster using ‘virtualbox’ hypervisor …
— Minishift VM will be configured with …
Memory: 4 GB
vCPUs : 2
Disk size: 20 GB
— Starting Minishift VM …………………………………………………………. OK
— Checking for IP address … OK
— Checking for nameservers … OK
— Checking if external host is reachable from the Minishift VM …
Pinging 8.8.8.8 … OK
— Checking HTTP connectivity from the VM …
Retrieving http://minishift.io/index.html … OK
— Checking if persistent storage volume is mounted … OK
— Checking available disk space … 1% used OK
— Writing current configuration for static assignment of IP address … OK
Importing ‘openshift/origin-control-plane:v3.11.0’ . CACHE MISS
Importing ‘openshift/origin-docker-registry:v3.11.0’ . CACHE MISS
Importing ‘openshift/origin-haproxy-router:v3.11.0’ . CACHE MISS
— OpenShift cluster will be configured with …
Version: v3.11.0
— Pulling the OpenShift Container Image ………………………………………………… OK
— Copying oc binary from the OpenShift container image to VM … OK
— Starting OpenShift cluster ………………………………………………………………………………………..
Getting a Docker client …
Checking if image openshift/origin-control-plane:v3.11.0 is available …
Pulling image openshift/origin-cli:v3.11.0
E0610 11:41:17.513088 5298 helper.go:173] Reading docker config from /home/docker/.docker/config.json failed: open /home/docker/.docker/config.json: no such file or directory, will attempt to pull image docker.io/openshift/origin-cli:v3.11.0 anonymously
Image pull complete
Pulling image openshift/origin-node:v3.11.0
E0610 11:41:21.932429 5298 helper.go:173] Reading docker config from /home/docker/.docker/config.json failed: open /home/docker/.docker/config.json: no such file or directory, will attempt to pull image docker.io/openshift/origin-node:v3.11.0 anonymously
Pulled 5/6 layers, 84% complete
Pulled 5/6 layers, 91% complete
Pulled 5/6 layers, 99% complete
Pulled 6/6 layers, 100% complete
Extracting
Image pull complete
Checking type of volume mount …
Determining server IP …
Using public hostname IP 192.168.99.103 as the host 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.0 is available …
I0610 11:42:46.592821 5298 config.go:40] Running “create-master-config”
Starting OpenShift using openshift/origin-control-plane:v3.11.0 …
I0610 11:42:49.362781 5298 config.go:46] Running “create-node-config”
I0610 11:42:50.221651 5298 flags.go:30] Running “create-kubelet-flags”
I0610 11:42:50.658843 5298 run_kubelet.go:49] Running “start-kubelet”
I0610 11:42:50.868437 5298 run_self_hosted.go:181] Waiting for the kube-apiserver to be ready …
I0610 11:45:21.887333 5298 interface.go:26] Installing “kube-proxy” …
I0610 11:45:21.887370 5298 interface.go:26] Installing “kube-dns” …
I0610 11:45:21.887380 5298 interface.go:26] Installing “openshift-service-cert-signer-operator” …
I0610 11:45:21.887406 5298 interface.go:26] Installing “openshift-apiserver” …
I0610 11:45:21.887442 5298 apply_template.go:81] Installing “openshift-apiserver”
I0610 11:45:21.887668 5298 apply_template.go:81] Installing “kube-proxy”
I0610 11:45:21.889130 5298 apply_template.go:81] Installing “kube-dns”
I0610 11:45:21.889388 5298 apply_template.go:81] Installing “openshift-service-cert-signer-operator”
I0610 11:45:29.205152 5298 interface.go:41] Finished installing “kube-proxy” “kube-dns” “openshift-service-cert-signer-operator” “openshift-apiserver”
I0610 11:49:14.230117 5298 run_self_hosted.go:242] openshift-apiserver available
I0610 11:49:14.230787 5298 interface.go:26] Installing “openshift-controller-manager” …
I0610 11:49:14.230810 5298 apply_template.go:81] Installing “openshift-controller-manager”
I0610 11:49:18.117466 5298 interface.go:41] Finished installing “openshift-controller-manager”
Adding default OAuthClient redirect URIs …
Adding centos-imagestreams …
Adding registry …
Adding router …
Adding web-console …
Adding sample-templates …
Adding persistent-volumes …
I0610 11:49:18.140199 5298 interface.go:26] Installing “centos-imagestreams” …
I0610 11:49:18.140207 5298 interface.go:26] Installing “openshift-image-registry” …
I0610 11:49:18.140213 5298 interface.go:26] Installing “openshift-router” …
I0610 11:49:18.140220 5298 interface.go:26] Installing “openshift-web-console-operator” …
I0610 11:49:18.140225 5298 interface.go:26] Installing “sample-templates” …
I0610 11:49:18.140230 5298 interface.go:26] Installing “persistent-volumes” …
I0610 11:49:18.140643 5298 apply_list.go:67] Installing “centos-imagestreams”
I0610 11:49:18.141507 5298 apply_template.go:81] Installing “openshift-web-console-operator”
I0610 11:49:18.141649 5298 interface.go:26] Installing “sample-templates/mongodb” …
I0610 11:49:18.141657 5298 interface.go:26] Installing “sample-templates/cakephp quickstart” …
I0610 11:49:18.141663 5298 interface.go:26] Installing “sample-templates/sample pipeline” …
I0610 11:49:18.141668 5298 interface.go:26] Installing “sample-templates/mariadb” …
I0610 11:49:18.141673 5298 interface.go:26] Installing “sample-templates/mysql” …
I0610 11:49:18.141678 5298 interface.go:26] Installing “sample-templates/postgresql” …
I0610 11:49:18.141683 5298 interface.go:26] Installing “sample-templates/dancer quickstart” …
I0610 11:49:18.141689 5298 interface.go:26] Installing “sample-templates/django quickstart” …
I0610 11:49:18.141696 5298 interface.go:26] Installing “sample-templates/nodejs quickstart” …
I0610 11:49:18.141702 5298 interface.go:26] Installing “sample-templates/rails quickstart” …
I0610 11:49:18.141708 5298 interface.go:26] Installing “sample-templates/jenkins pipeline ephemeral” …
I0610 11:49:18.141737 5298 apply_list.go:67] Installing “sample-templates/jenkins pipeline ephemeral”
I0610 11:49:18.141905 5298 apply_list.go:67] Installing “sample-templates/mongodb”
I0610 11:49:18.142001 5298 apply_list.go:67] Installing “sample-templates/cakephp quickstart”
I0610 11:49:18.142090 5298 apply_list.go:67] Installing “sample-templates/sample pipeline”
I0610 11:49:18.142170 5298 apply_list.go:67] Installing “sample-templates/mariadb”
I0610 11:49:18.142251 5298 apply_list.go:67] Installing “sample-templates/mysql”
I0610 11:49:18.142370 5298 apply_list.go:67] Installing “sample-templates/postgresql”
I0610 11:49:18.142457 5298 apply_list.go:67] Installing “sample-templates/dancer quickstart”
I0610 11:49:18.142535 5298 apply_list.go:67] Installing “sample-templates/django quickstart”
I0610 11:49:18.142616 5298 apply_list.go:67] Installing “sample-templates/nodejs quickstart”
I0610 11:49:18.142697 5298 apply_list.go:67] Installing “sample-templates/rails quickstart”
I0610 11:49:33.183109 5298 interface.go:41] Finished installing “sample-templates/mongodb” “sample-templates/cakephp quickstart” “sample-templates/sample pipeline” “sample-templates/mariadb” “sample-templates/mysql” “sample-templates/postgresql” “sample-templates/dancer quickstart” “sample-templates/django quickstart” “sample-templates/nodejs quickstart” “sample-templates/rails quickstart” “sample-templates/jenkins pipeline ephemeral”
I0610 11:52:04.653231 5298 interface.go:41] Finished installing “centos-imagestreams” “openshift-image-registry” “openshift-router” “openshift-web-console-operator” “sample-templates” “persistent-volumes”
Login to server …
Creating initial project “myproject” …
Server Information …
OpenShift server started.

The server is accessible via web console at:
https://192.168.99.103:8443/console

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

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

— Exporting of OpenShift images is occuring in background process with pid 11844.

You can now create project via the GUI from:

https://YOUR_IP_ADDRESS:8443/console

You can create Openshift projects and even open the Openshift GUI in your broswer:

As instructed login to the GUI with user system and password admin

In order to be able to create projects from the CLI, you need the oc and kubectl execubles.

Run:

minishift oc-env

This will show you something like

PS C:\Users\Steve\Downloads\minishift-1.34.0-windows-amd64\minishift-1.34.0-windows-amd64> .\minishift.exe oc-env
$Env:PATH = “C:\Users\Steve\.minishift\cache\oc\v3.11.0\windows;$Env:PATH”
# Run this command to configure your shell:
# & minishift oc-env | Invoke-Expression
PS C:\Users\Steve\Downloads\minishift-1.34.0-windows-amd64\minishift-1.34.0-windows-amd64>

You can also download the exectubles and be able to run any Openshift project that you have access to.

Then run as it says:

& minishift oc-env | Invoke-Expression

Now you should be able to run the oc and kubectl commands which are central to Openshift.

Download Openshift OC and minikube windows exectubles

https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-windows.zip

You can open them and run a powershell from that dir, even add it to your path

When the installation gets stuck you can run

.\minishift.exe delete

https://docs.okd.io/latest/minishift/getting-started/uninstalling.html

From within a Centos 7 VM, after installing docker you can run Openshift Origin in a VM

To get started I ran the following command. Next time for security I will get it to run NOT as root, but this will do for now as POC Proof of Concept

sudo docker run -d –name “origin” –privileged –pid=host –net=host -v /:/rootfs:ro -v /var/run:/var/run:rw -v /sys:/sys -v /sys/fs/cgroup:/sys/fs/cgroup:rw -v /var/lib/docker:/var/lib/docker:rw -v /var/lib/origin/openshift.local.volumes:/var/lib/origin/openshift.local.volumes:rslave openshift/origin start

This is formerly called Origin

sudo docker run -d –name “origin” \ –privileged –pid=host –net=host \ -v /:/rootfs:ro -v /var/run:/var/run:rw -v /sys:/sys -v /sys/fs/cgroup:/sys/fs/cgroup:rw \ -v /var/lib/docker:/var/lib/docker:rw \ -v /var/lib/origin/openshift.local.volumes:/var/lib/origin/openshift.local.volumes:rslave \ openshift/origin start

To use only Virtualbox as your VM run:

 .\minishift.exe config set vm-driver virtualbox

Source: Setting Up a Cluster | Getting Started | OKD 3.11

Also see: https://docs.okd.io/latest/minishift/index.html

https://www.okd.io/download.html

https://docs.okd.io/latest/minishift/getting-started/setting-up-virtualization-environment.html#for-windows

Leave a Reply