Are you looking to develop a few projects on your local machine and push them on to a real OpenShift Container Platform without having to worry about cloud hosting of your container platform?
Would you like to do that on one of the newer versions of OpenShift Container Platform such as version 4.7?
Look no further as CodeReady Containers puts it all at your fingertips. Experience the joys of cloud native development and automated rolling deployments.
The idea was to make this as streamlined of an experience as possible by using the same CodeReady Containers Easy Install project. Let’s take a look at what this looks like.
Below is a walk through step by step, putting the latest OpenShift Container Platform on your local developer machine.
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 CodeReady 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 the 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 CodeReady Containers Easy Install project and unzipping in some directory. This gives you a file called ocp-install-demo-main.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 CodeReady 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.
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 platform’s virtualization (Hyperkit), then looking for the OpenShift client version (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 CodeReady Containers cluster starts, which takes some time depending on your network (crc start). With a good network 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
Login with user: kubeadmin
Password in our case: duduw-yPT9Z-hsUpq-f3pre
That opens the main dashboard:
Verify the version you are running by clicking on the top right question mark and then About option:
Close the version window by clicking on the X. As we are interested in developing using the tooling and container images provided by CodeReady Containers, let’s change the view from Administrator to Developer in the left top menu selecting Topology and then via Project drop down menu at the top choose Default:
You can browse the offerings in the provided container catalog by selecting From Catalog and then for example, Middleware to view the offerings available:
Looking to get started with an example usage, try the Red Hat Process Automation Manager or Red Hat Decision Manager examples that leverage the provided developer catalog container images. You can also explore how an existing project is set up using one of the developer catalog container images with a human resources employee rewards project.
This concludes the installation and tour of an OpenShift Container Platform on our local machine using CodeReady 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!
If you are interested in the previous version 4.6, see this post for details on how to install.
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 the OpenShift Container Platform 4.7 on your local machine
Opinions expressed by System Code Geeks contributors are their own.