Red Hat® OpenShift® 4 users can access certified software for container-based environments via the Red Hat Marketplace. Software in the marketplace is immediately available to deploy on any Red Hat OpenShift cluster in a fast, integrated way. In this tutorial, we show you how to get up and running with CockroachDB hosted on Red Hat Marketplace. CockroachDB is an elastic SQL database that easily scales transactions for your apps and services.
- Red Hat OpenShift version 4.3 is required to use with software in Red Hat Marketplace. You can set up a class cluster on IBM Cloud using these instructions: Set up an OpenShift Cluster.
- Create an account on Red Hat Marketplace.
To get up and running with CockroachDB hosted on Red Hat Marketplace you will:
- Configure a Red Hat OpenShift cluster with Red Hat Marketplace
- Connect to the OpenShift Cluster in your CLI
- Deploy a CockroachDB Operator on an OpenShift cluster
- Create a database instance
1. Configure a Red Hat OpenShift cluster with Red Hat Marketplace
To configure a Red Hat OpenShift cluster with Red Hat Marketplace, you need to download the OpenShift CLI binary, register the cluster on Red Hat Marketplace, and create a project in the Red Hat Marketplace console.
Download an OpenShift command line interface (CLI) binary
To launch the cluster console — also called Red Hat OpenShift Container Platform — follow these steps:
Log in to your IBM Cloud account and navigate to the dashboard.
Click Clusters and select the cluster you created in the prerequisites. In this case, the cluster name is
After you launch the cluster, click the OpenShift web console button on the top right-hand side of your screen.
From the Red Hat OpenShift Container Platform web console, select the question mark icon on the top right-hand side and select Command Line Tools.
Navigate to the section
oc - OpenShift Command Line Interface (CLI)and download the respective oc binary onto your local system.
Note: You need this binary to manage OpenShift projects from a terminal and to natively support OpenShift Container Platform features.
Now you are ready to register the OpenShift cluster on Red Hat Marketplace. This step is mandatory to install any operators from Red Hat Marketplace platform using the OpenShift cluster.
Register the cluster on Red Hat Marketplace
Log in to the Red Hat Marketplace. Select a workspace and click Clusters. You need to add the new OpenShift cluster and register it on the Red Hat Marketplace platform.
Update the cluster name, follow prompts to generate a pull secret, and save it.
In the GUI, copy the
curlcommand which starts with
curl -sL httpsand append the pull secret towards the end. Keep the entire script handy to use in the next step.
You need to start the cluster first to register it. Open a terminal and type
oc login, update the username and password which are used for accessing the cluster, and press Enter.
Your cluster should be up and running at this point. You need to run the entire script from the previous step and hit
Enter. It will take a couple of minutes to see that you have successfully registered the cluster on the Red Hat Marketplace portal. In the Status column, you should see the word “Registered” beside a green circle.
Create a project in the Red Hat Marketplace web console
To create a project that you can use and manage from the command line, go to the Red Hat Marketplace web console and click Create Project. Name the project:
2. Connect to the OpenShift cluster in your CLI
Log in to the Red Hat OpenShift on IBM Cloud Kubernetes Service cluster through your CLI. To log in, you need a token which can be generated after you log in to OpenShift Cluster web console. Click the drop-down under your name in the right corner of your screen and select Copy Login Command.
A new window will open requesting the login token details. Copy the login token.
In your terminal, paste the login token. Once you log in, you should see a screen that has information about your login name, your server, the token, and the projects.
3. Deploy a CockroachDB Operator on an OpenShift cluster
Now that you have your clusters set up, the following steps show you how to deploy a CockroachDB operator on an OpenShift cluster.
Go to the Red Hat Marketplace catalog and search for CockroachDB. Select
CockroachDBfrom the results.
The CockroachDB product page gives you an overview, documentation, and pricing options associated with the product. Select the
Next, the purchase summary will show the Subscription term, with a total cost of $0.00. Click Start trial.
You can visit Workspace > My Software to view your list of purchased software.
In the Red Hat Marketplace dashboard, select the CockroachDB tile, and then click the Operators tab. Select the Install Operator button. Leave the default selection for Update channel and Approval strategy. Select the cluster and namespace scope as
cockroachdb-testfor the operator and click Install.
You should see a message that indicates the install process initiated in the cluster.
4. Create a database instance
Log in to your OpenShift cluster. From the left navigation, click Operators and select Installed Operators to confirm the installation was successful. You should see the
CockroachDBoperator listed under the
On the CockroachDB operator screen, look under Provided APIs and click on Create Instance.
The Create Cockroachdb page displays with the default YAML. Do not edit anything in the YAML file; just click the Create button.
CockroachDB pods should come up when the database installation is completed.
Run the following command in your terminal to check the status:
$ oc project cockroachdb-test
You should get a result similar to the following:
Now using project "cockroachdb-test" on server "https://c107-e.us-south.containers.cloud.ibm.com:32137".
At this point, the database pods are deployed, up, and running. To check the pods, run the following command:
$ kubectl get pods
NAME READY STATUS RESTARTS AGE cockroachdb-6867d47bc5-l44zs 1/1 Running 0 12d example-cockroachdb-0 1/1 Running 3 3d21h example-cockroachdb-1 1/1 Running 1 12d example-cockroachdb-2 1/1 Running 3 12d example-cockroachdb-init-nzvx8 0/1 Completed 0 12d
This tutorial shows you how to configure a Red Hat OpenShift cluster with Red Hat Marketplace, connect it in your CLI, and deploy and create CockroachDB database instance on OpenShift cluster.