MiniShift setup on Windows: OpenShift on Windows

OpenShift Logo

OpenShift is a great PaaS platform by Red Hat that leverages container technologies such as Docker and Kubernetes. If you want to try OpenShift but don’t want to set up a real, full-blown cluster this solution is for you. Minishift is a great way to test OpenShift capabilities without committing hardware to it. By using MiniShift you will set up a virtual machine on your hardware, this vm will be your very own one-machine cluster and when you’re done you can simply throw it away.

Why OpenShift on Windows?

OpenShift, Docker, Kubernets are all Linux-based solutions, made for and battle-tested on Linux. Installing OpenShift on Windows might seem strange, but it’s not. Well, most of the times OpenShift is installed on Windows just for testing or proof of concept purposes. (What is OpenShift?)

By installing MiniShift you will essentially download and install a Linux virtual machine configured with OpenShift, it is hence highly discouraged to use it in production.

Requirements

  • You need a machine capable of performing Virtualization.
  • If you want to use HyperV, you need a compatible Windows edition (e.g. Windows 10 Pro. Windows 10 Home can’t.)
  • At least 4GB of RAM (suggested).

MiniShift on Windows: HyperV or VirtualBox

The first thing you will need in order to begin is a hypervisor to run the Minishift virtual machine, you can either use:

  • HyperV: the native Windows hypervisor.
  • VirtualBox: an open source hypervisor by Oracle available on many operating systems.

Although the suggested hypervisor is VirtualBox you should be able to install it using HyperV without major issues, and by default Minishift will try to use the latter. In this tutorial you can use either one, I will assume you already have your hypervisor installed and running.

Getting MiniShift and setting environment

Let’s start!

  • First: download the Minishift executable, pick the one for Windows. The link takes you to the latest version, at the moment of writing this article the latest version was v1.10.0.
  • Second: extract the content of the folder in a subdirectory of C:\ it’s best to avoid other drives/network drives. I suggest you to extract it in the C:\minishift subdirectory.
  • Third: add the path you chose to the PATH environment variable. You can do so graphically or using the following PowerShell command:
PS> [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\minishift", [EnvironmentVariableTarget]::Machine)

Replace C:\minishift with the path you chose during the second step. Now that you have set the environment up, it’s time to install!

Installing MiniShift

With the environment set, you’re just a few steps away from installing and using Minishift. Pick the steps associated with your hypervisor and open an elevated PowerShell prompt:

HyperVVirtualBox

Before you actually do anything you must be part of the HyperV Administrators group. If you’re using a different language you will need to replace Hyper-V Administrators with the corresponding group in your system’s language.

Although you can add yourself to the group in your own language, as the time of writing this article, it doesn’t work and you will need an elevated PowerShell prompt.

You can add yourself by typing:

PS> ([adsi]”WinNT://./Hyper-V Administrators,group”).Add(“WinNT://$env:UserDomain/$env:Username,user”)

Next you will need to create an External switch, your VMs will need it to connect to the internet. Follow these steps by Microsoft to create the External switch, be sure to pick External as type.

Now you need to set the environment variable to tell Minishift which switch to use. Replace the value (in this case External) with the name you chose for the switch earlier.

PS> $env:HYPERV_VIRTUAL_SWITCH="External"

Set up HyperV as default driver, this will prevent Minishift from using VirtualBox and breaking your computer:

PS> minishfit config set vm-driver hyperv

Now you can start the installation:

PS> minishift start
-- Starting profile 'minishift'
-- Checking if requested hypervisor 'hyperv' is supported on this platform ... OK
-- Checking if Hyper-V driver is installed ... OK
-- Checking if Hyper-V driver is configured to use a Virtual Switch ... OK
-- Checking if user is a member of the Hyper-V Administrators group ... OK
-- Checking the ISO URL ... OK
-- Starting local OpenShift cluster using 'hyperv' hypervisor ...
-- Minishift VM will be configured with ...
   Memory:    2 GB
   vCPUs :    2
   Disk size: 20 GB
-- Starting Minishift VM ............................ OK
-- Checking for IP address ... 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
-- Downloading OpenShift binary 'oc' version 'v3.6.0'
 33.92 MiB / 33.92 MiB [===============================================================================================================================================] 100.00% 0s-- Downloading OpenShift v3.6.0 checksums ... OK
-- OpenShift cluster will be configured with ...
   Version: v3.6.0
-- Checking `oc` support for startup flags ...
   host-config-dir ... OK
   host-data-dir ... OK
   host-pv-dir ... OK
   host-volumes-dir ... OK
   routing-suffix ... OK
Starting OpenShift using openshift/origin:v3.6.0 ...
Pulling image openshift/origin:v3.6.0
Pulled 1/4 layers, 26% complete
Pulled 1/4 layers, 74% complete
Pulled 2/4 layers, 78% complete
Pulled 3/4 layers, 96% complete
Pulled 4/4 layers, 100% complete
Extracting
Image pull complete
OpenShift server started.

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

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

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

Set up VirtualBox as default driver, this will prevent Minishift from using HyperV and breaking your computer:

PS> minishift config set vm-driver virtualbox

Now you can start the installation:

PS> minishift start
-- Starting profile 'minishift'
-- Checking if requested hypervisor 'virtualbox' is supported on this platform ... OK
-- Checking the ISO URL ... OK
-- Starting local OpenShift cluster using 'virtualbox' hypervisor ...
-- Minishift VM will be configured with ...
   Memory:    2 GB
   vCPUs :    2
   Disk size: 20 GB
-- Starting Minishift VM ........................... OK
-- Checking for IP address ... 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
-- OpenShift cluster will be configured with ...
   Version: v3.6.0
-- Checking `oc` support for startup flags ...
   host-config-dir ... OK
   host-data-dir ... OK
   host-pv-dir ... OK
   host-volumes-dir ... OK
   routing-suffix ... OK
Starting OpenShift using openshift/origin:v3.6.0 ...
Pulling image openshift/origin:v3.6.0
Pulled 1/4 layers, 26% complete
Pulled 2/4 layers, 72% complete
Pulled 3/4 layers, 88% complete
Pulled 4/4 layers, 100% complete
Extracting
Image pull complete
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: <any value>

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

Enjoy OpenShift with MiniShift

Congratulations! You just installed minishift! You can now type minishift console to open the Web UI in your default browser! Don’t worry about the insecure connection, that’s just because the certificate is self-signed.

OpenShift Web Login

OpenShift Web Login

Once logged: OpenShift Web Console

Accessing OpenShift

Now that you have OpenShift up and running, you can use the Web UI as well as the oc command line utility to interact with your OpenShift installation. Remember you still have the minishift executable that you can use to control the OpenShift vm.

Starting OpenShift

PS> minishift start

Stopping OpenShift

PS> minishift stop

Deleting (erasing completely) OpenShift

PS> minishift delete
You are deleting the Minishift VM: 'minishift'. Do you want to continue [y/N]?: y
Deleting the Minishift VM...
Minishift VM deleted.
Image courtesy of mark | marksei
mark

You may also like...

11 Responses

  1. Marc Richter says:

    In the virtualbox guide, there is a typo:
    “minishfit config set vm-driver virtualbox”
    minishfit -> minishift

    Best regards,
    Marc

  2. Dhrumil says:

    what version of virtualbox have you used? i’m facing issues setting up minishift on windows 8.1 (issue detail: https://github.com/minishift/minishift/issues/2734) using virtualbox 5.2.18

    • mark says:

      Hello Dhrumil, I can’t remember the exact version, but according to the time this article was written it should be version 5.2.2. My best guess is that your setup, your OS version in particular, are causing this issue. If that’s not the case you may try downgrading your VirtualBox version a few times and see what happens.

  3. Kevin Wong says:

    cannot oc cluster up, because I got this error:
    + nsenter –mount=/rootfs/proc/1/ns/mnt mount -o bind varliborigincluster-upC:tempopenshift.local.clusterupopenshift.local.volumes varliborigincluster-upC:tempopenshift.local.clusterupopenshift.local.volumes
    mount: varliborigincluster-upC:tempopenshift.local.clusterupopenshift.local.volumes: mount point does not exist.

    • mark says:

      Hello Kevin, in this tutorial I haven’t mentioned the “oc cluster up” instruction (part of a manual cluster installation rather than MiniShift). Where does it pop from?

  4. Tamás says:

    I think this:

    “Set up VirtualBox as default driver, this will prevent Minishift from using VirtualBox and breaking your computer:”

    Should be:

    “Set up VirtualBox as default driver, this will prevent Minishift from using HyperV and breaking your computer:”

  5. Pavel Sosin says:

    So, is minishift on WSL2 iexpected? The same pre-packed Linux image running inside lightweight virtual machine with no barriers with host FS and network. Kubernetes runs fine. Maybe on top of Kubernetes?

    • mark says:

      Hello Pavel, I think that is really improbable. Seeing how OKD/OS4 have shifted to a managed host operating system model, I think it will be difficult to integrate that seamlessly with filesystems and even worse, networking.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: