We will be creating a single-node cluster for Red Hat OpenShift Container Platform.
Once you’ve downloaded and installed CRC on your machine, you’re ready to use CRC by creating a cluster. OpenShift is the default cluster type that would be created when no explicit configuration is provided.
Set up environment for your cluster
Before starting cluster, you need to prepare your machine for creating a Virtual Machine. OpenShift cluster would be started
inside that Virtual Machine. In order to do that use crc setup
command.
Open a terminal with a user account with administrator access (but not logged in as root user) and run:
$ crc setup
Start your cluster
Once you’ve set up environment for your OpenShift cluster, you can go ahead and start it.
When you’d start the cluster, you would be asked for pull secret. You need to create a Red Hat account and download this file from the Pull Secret section of the CRC page on the Red Hat Hybrid Cloud Console. |
$ crc start
Log into your cluster
Once you’ve created the cluster, and it’s up and running, you need to log in into your OpenShift cluster. In order to do that, use OpenShift CLI (oc
).
If you already have OpenShift CLI (oc
), you can start using it. If not, you can use Run the crc oc-env
command to print the command needed to add the cached oc
executable to your $PATH
.
$ crc oc-env
Get the OpenShift CLI (oc
) login command using crc console
to login as regular user or admin.
Copy login command from this CRC command output and paste it into your terminal:
$ crc console --credentials
Deploy a sample application to your OpenShift cluster
We will be deploying a simple Java application using a tool called Eclipse JKube OpenShift Maven Plugin.
In order to follow these steps, you would need to have these installed:
Once you’ve installed these dependencies, you can deploy any java application to OpenShift cluster.
Clone Eclipse JKube repository and go to one of the quickstarts:
$ git clone https://github.com/eclipse-jkube/jkube.git $ cd jkube/quickstarts/maven/quarkus
Run JKube OpenShift Maven Plugin goal to build and deploy application to OpenShift cluster:
$ mvn package oc:build oc:resource oc:apply
Wait till application pod comes in ready state and access the application via route:
$ oc get routes $ curl http://quarkus-default.apps-crc.testing