{{announcement.body}}
{{announcement.title}}

Getting Started With Distributed SQL on Red Hat OpenShift With YugabyteDB Operator

DZone 's Guide to

Getting Started With Distributed SQL on Red Hat OpenShift With YugabyteDB Operator

YugabyteDB Operator allows developers to run clusters on OpenShift using the same cloud native practices they have come to use with stateless applications

· Database Zone ·
Free Resource

We are happy to announce that the YugabyteDB Operator is now certified and available as a Beta release on Red Hat OpenShift, a leading enterprise Kubernetes platform for deploying and managing cloud native applications. Achieving certification means that customers can deploy YugabyteDB on OpenShift with confidence because the YugabyteDB container image has been secured, validated, and is well-integrated to run on OpenShift. And the solution is backed by collaborative support between Red Hat and Yugabyte, so enterprises can easily reach out for help and guidance along the way.

YugabyteDB brings support for both scale-out RDBMS and internet-scale OLTP workloads onto OpenShift, enabling customers to transition these workloads to enterprise-grade Kubernetes. The YugabyteDB Operator allows developers to run YugabyteDB clusters on OpenShift using the same cloud native practices they have come to use with stateless applications, such as scaling and managing the lifecycle of workloads using CI/CD pipelines. You can find the YugabyteDB Operator in the OperatorHub of your OpenShift environment.

YugabyteDB operator spec

The YugabyteDB Operator can be installed in your OpenShift environment and provide Kubernetes native management capabilities. It defines new Custom Resource Definitions (CRD’s), handles lifecycle events (such as scaling), and manages YugabyteDB running in pods. It provides a Kubernetes native custom resource via ybclusters.yugabyte.com for deploying and managing the YugabyteDB clusters.

In this post, we’ll go over the installation steps for deploying a highly available YugabyteDB distributed SQL cluster on a Red Hat OpenShift environment deployed on Google Cloud. (Note, you can do this on any public cloud with the OpenShift Container Platform and the YugabyteDB Operator.)

Red Hat OpenShift and Kubernetes

The above figure shows a high-level overview of the components involved for deploying a YugabyteDB cluster on Red Hat OpenShift using the YugabyteDB Operator.

A YugabyteDB cluster consists of two distributed services: yb-tserver and yb-master. The yb-tserver service is responsible for storing the application data and serving the client requests. yb-master is a lightweight service responsible for maintaining the system metadata (including table-to-shard-to-node mapping) and performing background operations such as automatic data rebalancing. You can learn more about the components in a YugabyteDB cluster here.

Red Hat OpenShift provides a managed Kubernetes cluster. Kubernetes is responsible for managing the lifecycle of the YugabyteDB Operator pods and CRDs that are registered with the Kube API. On creating the custom resource ybclusters.yugabyte.com, the YugabyteDB Operator creates the necessary statefulset pods with provided attributes like replication factor and desired pod count. It also bootstraps the additional services including a LoadBalancer service for exposing the YugabyteDB admin console.

Installation Prerequisites

  • Access to a Red Hat OpenShift environment with the following minimum requirements:
    • Red Hat OpenShift v4.3 or later.
    • 1 Kubernetes master node: 2 CPU, 4GB RAM.
    • 3 Kubernetes worker nodes: 8CPU, 16GB RAM.
  • Access to OperatorHub.
  • Subscription to Red Hat Certified Operators.
  • Docker installed locally.
  • About 15 minutes.

Install the YugabyteDB Operator on Red Hat OpenShift

Log into the OpenShift Container platform and navigate to OperatorHub. Search for the Yugabyte Operator under the database category.

Navigate to the Yugabyte Operator page and click on Install.

YugabyteDB Operator

Select a Kubernetes namespace of choice for installing the YugabyteDB Operator. We have selected the default namespace for installing the Operator.

Create an Operator subscription

The YugabyteDB Operator will be installed and we can verify the operator by navigating to the Installed Operator page.

Create a YugabyteDB Cluster

Once the YugabyteDB Operator is installed, we can deploy a YugabyteDB cluster by defining the necessary parameters for the custom resource ybcluster. By default, custom resource ybcluster creates a YugabyteDB cluster with Replication Factor 3 (RF3). The current version of the YugabyteDB Operator provides the following configuration parameters:

  • Image Override – Mention YugabyteDB Docker image attributes such as repository, tag, and pullPolicy under image.
  • Replication Factor – The desired replication factor for the YugabyteDB cluster. Default is RF-3.
  • Master Pod Count – The desired pod count for yb-master. Default is 3.
  • T-server Pod Count – The desired pod count for yb-tserver. Default is 3.
  • Enable TLS – Enable TLS encryption for YugabyteDB, if desired. It is disabled by default. To enable TLS communication refer to configuring TLS.

In the OpenShift console, navigate to the YugabyteDB Operator in the installed Operator page. You will see a landing page with configuration and installation instructions.

Provided APIs

Let us now deploy an RF3 YugabyteDB cluster using the installed operator. Click on Create Instance for configuring and deploying the YugabyteDB cluster and press the create button.

By default, ybcluster crd will create a TLS-enabled cluster that requires us to provide a CA certificate. For this blog post, we have disabled the TLS communication between the yb-master and yb-tserver pods. We disabled TLS communication by setting the configuration flag use_node_to_node_encryption to false in both the yb-master and yb-tserver yaml definitions. Also, we need to delete the tls spec from the deployment yaml file.

Creating YB Cluster

This creates a new YBCluster CRD and the Operator takes over reconciling the necessary resources. The YugabyteDB Operator creates the YugabyteDB statefulsets and bootstraps the necessary services required for the database. Within minutes, you’ll have a YugabyteDB cluster available to use on Red Hat OpenShift.

example cluster repository

Check the YugabyteDB Cluster Status

Every YugabyteDB cluster exposes a yb-master UI, which provides the details of the cluster, sharding information of the tables, and also the cluster metrics. Retrieve the yb-master UI load balancer IP address from yb-master-ui load balancer service.

Checking cluster status

Navigate to the YugabyteDB master UI using the load balancer IP address retrieved in the previous screen.

Conclusion

This blog post shows a quick and easy way for developers to get started with YugabyteDB on the Red Hat OpenShift container platform. As you can see with minimal steps, OpenShift administrators can enable the YugabyteDB Operator which allows application development teams to provision YugabyteDB-as-a-service on OpenShift. This allows developers to achieve the same high velocity with backend services as they are used to with stateless apps when architecting cloud native applications on a OpenShift container platform.

Topics:
kubernetes, mongodb, operator, oracle, redhat, sql, yugabytedb

Published at DZone with permission of Nikhil Chandrappa . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}