Currently we have many requests to support customers in running PostgreSQL in Docker containers. Some of those use redhat OpenShift as the management platform for their Docker deployments. Setting up an OpenShift cluster requires quite some resources and is nothing you want to do on your workstation usually. To overcome that you can use MiniShift which launches a one node OpenShift cluster which you can use for testing. Setting that up is quite easy.
Obviously MiniShift needs to be downloaded. I’ll be running MiniShift on my workstation and will use VirtualBox as the Hypervisor for Minishift:
dwe@box:~$ sudo mkdir /opt/minishift [sudo] password for dwe: dwe@box:~$ sudo chown dwe:dwe /opt/minishift dwe@box:~$ cd /opt/minishift dwe@box:/opt/minishift$ wget https://github.com/minishift/minishift/releases/download/v1.16.1/minishift-1.16.1-linux-amd64.tgz dwe@box:/opt/minishift$ tar -axf minishift-1.16.1-linux-amd64.tgz dwe@box:/opt/minishift$ cd minishift-1.16.1-linux-amd64/ dwe@box:/opt/minishift/minishift-1.16.1-linux-amd64$ export PATH=/opt/minishift/minishift-1.16.1-linux-amd64:$PATH dwe@box:/opt/minishift/minishift-1.16.1-linux-amd64$ minishift config set vm-driver virtualbox No Minishift instance exists. New 'vm-driver' setting will be applied on next 'minishift start'
Now MiniShift can be started:
dwe@box:/opt/minishift/minishift-1.16.1-linux-amd64$ minishift start
The output should look similar to this:
-- Starting profile 'minishift' -- Checking if https://github.com is reachable (using proxy: "No") ... OK -- Checking if requested OpenShift version 'v3.9.0' is valid ... OK -- Checking if requested OpenShift version 'v3.9.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 -- Downloading OpenShift binary 'oc' version 'v3.9.0' 42.11 MiB / 42.11 MiB [========================================================================================================================] 100.00% 0s-- Downloading OpenShift v3.9.0 checksums ... OK -- Checking if provided oc flags are supported ... OK -- Starting local OpenShift cluster using 'virtualbox' hypervisor ... -- Minishift VM will be configured with ... Memory: 2 GB vCPUs : 2 Disk size: 20 GB Downloading ISO 'https://github.com/minishift/minishift-b2d-iso/releases/download/v1.2.0/minishift-b2d.iso' 40.00 MiB / 40.00 MiB [========================================================================================================================] 100.00% 0s -- 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 ... 0% used OK Importing 'openshift/origin:v3.9.0' . CACHE MISS Importing 'openshift/origin-docker-registry:v3.9.0' CACHE MISS Importing 'openshift/origin-haproxy-router:v3.9.0' CACHE MISS -- OpenShift cluster will be configured with ... Version: v3.9.0 Pulling image openshift/origin:v3.9.0 Pulled 1/4 layers, 26% complete Pulled 2/4 layers, 72% complete Pulled 3/4 layers, 82% complete Pulled 4/4 layers, 100% complete Extracting Image pull complete Using Docker shared volumes for OpenShift volumes Using 192.168.99.100 as the server IP Starting OpenShift using openshift/origin:v3.9.0 ... OpenShift server started. The server is accessible via web console at: https://192.168.99.100:8443 You are logged in as: User: developer Password: To login as administrator: oc login -u system:admin -- Exporting of OpenShift images is occuring in background process with pid 7708.
You should also see a new VM in VirtualBox:
As we will need the oc binary to work with OpenShift we need to add that to the PATH:
dwe@box:/opt/minishift/minishift-1.16.1-linux-amd64$ minishift oc-env export PATH="/home/dwe/.minishift/cache/oc/v3.9.0/linux:$PATH" # Run this command to configure your shell: # eval $(minishift oc-env) dwe@box:/opt/minishift/minishift-1.16.1-linux-amd64$ eval $(minishift oc-env) dwe@box:/opt/minishift/minishift-1.16.1-linux-amd64$ which oc
And we are ready to use OpenShift:
oc login -u system:admin Logged into "https://192.168.99.100:8443" as "system:admin" using existing credentials. You have access to the following projects and can switch between them with 'oc project ': default * edb kube-public kube-system myproject openshift openshift-infra openshift-node openshift-web-console Using project "edb".
The web interface is up and running is well:
… we could already start and deploy a PostgreSQL container but this is the topic for the next post. To stop MiniShift:
dwe@box:~$ minishift stop Stopping local OpenShift cluster... Cluster stopped.
Hope that helps.