Digital Developer Conference: Hybrid Cloud 2021. On Sep 21, gain free hybrid cloud skills from experts and partners. Register now

Get started using a CockroachDB operator hosted on Red Hat Marketplace

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.

Prerequisites

  • 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.

Steps

To get up and running with CockroachDB hosted on Red Hat Marketplace you will:

  1. Configure a Red Hat OpenShift Cluster with Red Hat Marketplace
  2. Deploy a CockroachDB Operator on an OpenShift cluster
  3. Create a database instance

1. Configure a Red Hat OpenShift Cluster with Red Hat Marketplace

Follow the steps in this tutorial to confirgure a Red Hat OpenShift cluster and connect to the cluster using your command line interface (CLI): Configure a Red Hat OpenShift cluster hosted on Red Hat Marketplace.

2. 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.

  1. Go to the Red Hat Marketplace catalog and search for CockroachDB. Select CockroachDB from the results.

  2. The CockroachDB product page gives you an overview, documentation, and pricing options associated with the product. Select the Free Trial button.

    rhm-freetrial

  3. Next, the purchase summary will show the Subscription term, with a total cost of $0.00. Click Start trial.

    rhm-starttrial

    You can visit Workspace > My Software to view your list of purchased software.

  4. 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-test for the operator and click Install.

    Install the operator

  5. You should see a message that indicates the install process initiated in the cluster.

3. Create a database instance

  1. 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 CockroachDB operator listed under the cockroachdb-test project.

    CockroachDB listed under cockraocdb-test

  2. On the CockroachDB operator screen, look under Provided APIs and click on Create Instance.

    Create an API instance

  3. The Create Cockroachdb page displays with the default YAML. Do not edit anything in the YAML file; just click the Create button.

    Yaml file

    CockroachDB pods should come up when the database installation is completed.

  4. 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".
    
  5. 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
    

Summary

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.