It’s been awhile since I’ve talked about running OpenShift Container Platform on your local machine.
This mean a container platform at your finger tips, one you can experience the joys of cloud native development and automated rolling deployments. Since I started pulling together ways to easily experience this with OpenShift Container Platform, back with version 3.3 believe it or not, we’ve come a long ways.
For some time now I’ve been waiting for the local installation that stopped being supported with OpenShift Container Platform 3.9 to reappear in version 4.x. Well now it’s finally here with the last release of OpenShift Container Platform 4.2, in the form of Code Ready Containers.
The idea was to make this as streamlined of an experience as possible by using the same OpenShift Container Platform Easy Local Install project. Let’s take a look at what this looks like.
The first focus was to have this work for Unix based operating systems using a single installation script. The secondary wish is to provide a windows based installation script.
Linux or Mac installation
This installation requires the following (all freely available):
First you need to ensure your virtualization tooling is installed for your platform, just search online for how to do that or your specific platform. Second you need to download the Code Ready Containers. Finally, you need the OpenShift client. Normally you’d expect to have to track these last two down but we’ve made this all easy by just including checks during the installation. If you have something installed, it checks the version, if good then it moves on with next steps. If anything is missing or wrong version, the installation stops and notifies you where to find that component for your platform (including URL).
Let’s get started by downloading the OpenShift Container Platform Easy Local Install Project and unzipping in some directory. This gives you a file called ocp-install-demo-master.zip,just unzip and run the
init.sh as follows:
Follow the instructions as each of the dependencies is checked and you’re provided with pointers to getting the versions you need for your platform.
Note: Each Code Ready Container download is tied to an embedded secret. This secret you need to download (link will be provided) as a file and you’ll be asked to point to that secret to start your container platform. This pull-secret has a 30 day lifespan, so once it’s expired you’ll need to download both a new Code Ready Container AND a new pull-secret.
Once you’ve gotten all the dependencies sorted out, the install runs like this:
A little ASCII art and then it’s checking for my platforms virtualization (Hyperkit), then looking for the OpenShift client version 4.2 (oc client), then running a setup (crc setup).
The next steps are providing the pull-secret-file, you can set this in the variables at the top of the installation script. Now the moment of truth, the Code Ready Containers cluster starts, which takes some time depending on your network (crc start). With a good networks it’s about a five minute wait.
This is the logging you’ll see as the OpenShift cluster starts on your local machine. The warning is normal, just some of the features have been trimmed to speed up deployment.
At the end we’ll retrieve the admin password for logging in to the cluster’s console, pick up the host URL, test the deployment by logging in with our client (oc login), and finally you’re given all the details in a nice box. You have the option to stop, start it again, or delete the OpenShift Container Platform cluster as shown in the dialog.
Next open the web console using URL and login ‘kubeadmin’ with the corresponding password. In our case it’s the URL: https://console-openshift-console.apps-crc.testing
Log in with user: kubeadmin
Password in our case: wyozw-5ywAy-5yoap-7rj8q
That opens the main dashboard:
This concludes the installation of an OpenShift Container Platform on our local machine using Code Ready Containers.
What about Windows?
If you are a sharp observer, you’ll notice there is a file called init.bat for windows platforms to install with. The problem is I’ve not been able to test this yet on a windows machine, so I’d love to call out to the readers out there that might have some time to contribute to test this script and help us complete the installation. You’ll notice a few TODO’s marked in the scripts code, as they are untested areas in the installation.
You can raise new issues here and help us complete the windows based installation and get your name added to the contributors list. We’d be really thankful!
Stay tuned for more on cloud native development using other Red Hat technologies on your new OpenShift Container Platform installed locally on your own machine!
Published on System Code Geeks with permission by Eric Schabell, partner at our SCG program. See the original article here: How to setup OpenShift Container Platform on your local machine in minutes
Opinions expressed by System Code Geeks contributors are their own.