We will be creating a single-node cluster for OpenShift Kubernetes Distribution.
Once you’ve downloaded and installed CRC on your machine, you’re ready to use CRC by creating a cluster. OKD is not the default cluster type that would be created when no explicit configuration is provided.
In order to instruct CRC to create a OKD cluster, we need to update CRC configuration:
$ crc config set preset okd
Set up environment for your cluster
Before starting cluster, you need to prepare your machine for creating a Virtual Machine. OKD 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 OKD cluster, you can go ahead and start it.
$ crc start
Log into your OKD cluster
Once you’ve created the cluster, and it’s up and running, you need to log in into your OKD cluster. In order to do that, use OKD 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 OKD 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 OKD 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 OKD 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