Open source Kubernetes

This is an alternative to deploying YugabyteDB manually using Yugabyte Operator. The Yugabyte operator is available on Red Hat's OperatorHub.io and hence YugabyteDB can be also be deployed using Operator Lifecycle Manager (OLM). As the name suggests, OLM is a tool to help deploy and manage operators on your cluster.

Prerequisites

A Kubernetes cluster and kubectl must be configured to communicate with the cluster.

Deploy YugabyteDB using OLM

YugabyteDB can be deployed on any Kubernetes cluster using OLM, as follows:

  1. Deploy OLM to enable it to manage the operator deployments, as follows:

    curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/0.13.0/install.sh | bash -s 0.13.0
    
  2. Install YugabyteDB operator, as follows:

    kubectl create -f https://operatorhub.io/install/yugabyte-operator.yaml
    

    The operator should reach the Succeeded phase:

    kubectl get csv -n operators
    
    NAME                       DISPLAY             VERSION   REPLACES   PHASE
    yugabyte-operator.v0.0.1   Yugabyte Operator   0.0.1                Succeeded
    
  3. Create YugabyteDB Custom Resource using the operator deployed in the previous step:

    kubectl create namespace yb-operator && kubectl create -f https://raw.githubusercontent.com/yugabyte/yugabyte-operator/master/deploy/crds/yugabyte.com_v1alpha1_ybcluster_cr.yaml
    

    The YugabyteDB cluster pods should be running:

    kubectl get pods -n yb-operator
    
    NAME           READY   STATUS    RESTARTS   AGE
    yb-master-0    1/1     Running   0          3m32s
    yb-master-1    1/1     Running   0          3m32s
    yb-master-2    1/1     Running   0          3m31s
    yb-tserver-0   1/1     Running   0          3m31s
    yb-tserver-1   1/1     Running   0          3m31s
    yb-tserver-2   1/1     Running   0          3m31s
    

Configuration flags

For information on configuration flags, see Configuration flags.

Use YugabyteDB

When all of the pods in the YugabyteDB cluster are running, execute the following command in YSQL shell (ysqlsh) to access the YSQL API, which is PostgreSQL-compliant:

kubectl exec -it -n yb-operator yb-tserver-0 -- ysqlsh -h yb-tserver-0  --echo-queries

For details on the YSQL API, see the following:

Clean up

To remove the YugabyteDB cluster and operator resources, including the database itself and all the data, run the following commands:

kubectl delete -f https://raw.githubusercontent.com/yugabyte/yugabyte-operator/master/deploy/crds/yugabyte.com_v1alpha1_ybcluster_cr.yaml
kubectl delete namespace yb-operator
kubectl delete -f https://operatorhub.io/install/yugabyte-operator.yaml