OpenShift locally with Minishift on Windows 10

Minishift is a tool that allows you to run OKD (OpenShift or Origin Kubernetes Distribution depends on who you ask) locally by launching a single node OKD cluster inside a virtual machine.

This is very useful if you are learning OpenShift or if you simply want to set up a nice development environment. There is a Minishift Enterprise (the one I use) that you can download free from Red Hat if you are registered, and a community edition Minishift.


This step-by-step guide explains how to install Minishift Enterprise locally on Windows 10 using VirtualBox and in future posts I can show you how to use it to run .NET Core applications that talk to some servers such as MongoDb or between them. In theory you can use Hyper-V instead VirtualBox, which would allow you to install Docker for Windows, but I have had some issues with Hyper-V so I prefer to use VirtualBox with Docker Toolbox instead (if possible uninstall Windows feature Hyper-V). Let's see it!

Pre-Requirements

  1. Install VirtualBox
  2. Install Git for Windows (on this guide we just want to use the Git Bash though)
  3. Register on a free Red Hat Developer Program account

Install and Run Minishift

  1. Download minishift and rename it to minishift.exe
  2. Download OpenShift CLI and rename it to oc.exe
  3. Move both minishift.exe and oc.exe to a folder. For example C:\minishift
  4. Add to the environment variable PATH the folder C:\minishift
  5. Create the following environment variables
    MINISHIFT_USERNAME=your_red_hat_username
    MINISHIFT_PASSWORD=your_red_hat_password
    MSYS_NO_PATHCONV=1

    The first two variables are for redhat credentials, the third one is if you are using Git for Windows to disable automatic path translation.
  6. Open Git Bash and setup the CDK by running
    minishift.exe setup-cdk
  7. Then set the driver to Virtual Box so that you don't have to specify this when running the start command
    minishift config set vm-driver virtualbox
  8. Run minishift
    minishift start --memory 8G --cpus 2
    Your minishift console (that's how the client web application is called) should be up and running on the IP that the command resulted on (e.g: https://192.168.99.100:8443). You can log as admin or as developer using whatever password.

Some Useful Commands

  • To view the console url
    minishift console --url
  • To stop minishift
    minishift stop
  • To delete minishift
    minishift delete

That is enough in order to create projects, browse catalogue, run pods with servers or applications, etc. In future guides I'll show you how to do basic things with your local Minishift cluster, but for today explore the console and remember that if you break it, simply delete minishift and recreate it! It's a nice sandbox if your goal is to learn more about Openshift.

Notice the MSYS_NO_PATHCONV=1  will mess up your git bash for commands such as npm. You can go around this problem by using npm.cmd instead (eg: npm.cmd -i @aspnet/signalr)

Comments