[Draft] Getting Started with OpenShift
You might have heard that IBM has bought Red Hat. Now we can start to speculate why but IMHO it had something to do with talking to the “cool kids” with OpenShift! I decided to check it out and see what it could mean for my current Infrastructure department.
Now instead of building the complete cluster story around OpenShift, I discovered something called “mini shift” that is, in its simplest explanation, a tool that builds and run a single node of the OKD (the community distribution) of OpenShift. So no need to build master and worker nodes, instal RHEL (as there does not exist any other distribution any more) or anything else.
As I am not a huge fan of Hyper-V (due to family matters ahum), we are going to use VirtualBox to deploy MiniShift. So before we download the tool, make sure you have download and installed VirtualBox. Next, download the tool to deploy OpenShift on the following website; https://www.okd.io/minishift head to the “release” page and you will be redirected to a github repository where we can download the tool. At the time of writing, my release (as I am using Windows) is [minishift-1.34.1-windows-amd64.zip].
Download the file and extract it on a location where you can find it using the command prompt (cmd). I downloaded it on my c:\ and extracted it there. Open a command prompt (cmd) as administrator and navigate to the extracted folder. I discovered that, by default, the tool is trying to use HyperV but we want VirtualBox. Therefore we have to provide it with an extra syntax in order to start it. Below is my command output where the syntax is also displayed
Microsoft Windows [Version 10.0.17134.345] (c) 2018 Microsoft Corporation. All rights reserved. C:\Windows\system32>cd / C:>cd minishift-1.34.1-windows-amd64 C:>minishift.exe start --vm-driver virtualbox
There are three ways of managing Open Shift; Web based, Rest API and the CLI. By default, Mini Shift has a web based management enabled on port 8443 as displayed in the output after finishing the command listed above. If you use your favourite browser and copy/past the complete URL, you get to login (there is no password, just type something).
The CLI tool is called OC and can be downloaded as a stand-alone-tool but comes pre-packaged with Mini Shift. The command to login is also displayed in the initial output after running the start command. Though we do need to set the environment variable in order for Windows to know where the tool is located. The minishift.exe is going to help here and by running a certain command, you will get a line that you can execute. Below the command line output. Note the output I got and I just copy & paste it again. The last command is the login command into the OC tool.
C:\minishift-1.34.1-windows-amd64>minishift.exe oc-env SET PATH=C:\Users\verho.minishift\cache\oc\v3.11.0\windows;%PATH% REM Run this command to configure your shell: REM @FOR /f "tokens=*" %i IN ('minishift oc-env') DO @call %i C:>SET PATH=C:\Users\verho.minishift\cache\oc\v3.11.0\windows;%PATH% C:>oc login -u system:admin Logged into "https://192.168.99.100:8443" as "system:admin" using existing credentials.
That’s it, you have it running but in order to understand pods, resources, builds applications and networking concepts… we need to test it with something. I decided to run a Mincraft server and found a docker image on github (https://hub.docker.com/r/itzg/minecraft-server) . Below my steps
- I started of with creating a new Project and named it “minecraft-server”,
- After selecting the project I choose “Deploy Image” and pasted the “Image Name” found in the hub.docker [itzg/minecraft-server]
- Clicked the search icon and hit “Deploy”
When I checked the “Application” section it stated that the container was crashing. I looked at the log (same page “View Log”) an noted the following error;
chmod: /data: Operation not permitted Please accept the Minecraft EULA at https://account.mojang.com/documents/minecraft_eula by adding the following immediately after 'docker run': -e EULA=TRUE
If you start a Minecraft server you will have to accept the EULA before you can start it. We can set this in a environment variable. Navigate to Applications –> Deployment –> Click your minecraft server –> Environment. Now set [EULA] in the Name section and [true] as its value. Hit Safe
Nice blog! Thanks for sharing! Let’s start using OpenShift (not on Hyper-V due family matters)