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. As the name suggests, OLM is a tool to help deploy and manage Operators on your cluster.
Read on to find out how you can deploy YugabyteDB with OLM.
Prerequisites
A Kubernetes cluster and kubectl
configured to talk to the cluster.
Deploy YugabyteDB using Operator Lifecycle Manager
YugabyteDB can be deployed on any Kubernetes cluster using OLM in three easy steps.
- Deploy Operator Lifecycle Manager, so that it can manage Operator deployments for you.
$ curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/0.13.0/install.sh | bash -s 0.13.0
- Install YugabyteDB operator
$ kubectl create -f https://operatorhub.io/install/yugabyte-operator.yaml
Watch your operator come up until it reaches Succeeded
phase.
$ kubectl get csv -n operators
NAME DISPLAY VERSION REPLACES PHASE
yugabyte-operator.v0.0.1 Yugabyte Operator 0.0.1 Succeeded
- Create YugabyteDB Custom Resource to create YugabyteDB cluster using operator deployed above
$ kubectl create namespace yb-operator && kubectl create -f https://raw.githubusercontent.com/yugabyte/yugabyte-operator/master/deploy/crds/yugabyte.com_v1alpha1_ybcluster_cr.yaml
Watch your YugabyteDB cluster pods come up.
$ 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 configuration flags, see Configuration flags.
Use YugabyteDB
When all of the pods in YugabyteDB cluster are running, you can use the 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:
Clean up
To remove the YugabyteDB cluster and operator resources, run the following commands.
NOTE: This will destroy your database and delete all of its data.
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