How to Deploy an OceanBase Cluster using ob-operator

Jul 16, 2024 | Programming

If you’re looking to deploy and manage an OceanBase cluster efficiently on Kubernetes, you’re in the right place! The ob-operator is a powerful tool that simplifies this process. In this guide, we’ll take you step-by-step through the deployment process, ensuring that you’re equipped with all the necessary information to get started.

Quick Start

Before we dive into the actual deployment, let’s check off a few prerequisites.

Prerequisites

  • A functional Kubernetes cluster with at least 2 CPU cores, 10GB of memory, and 100GB of storage space.
  • Installation of cert-manager for certificate management. Follow their installation documentation.
  • Access to the quay.io image registry or the option to apply mirrored cert-manager manifests using the command below:
  • kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/2.2.2_release/deploy/cert-manager.yaml
  • Ensure local-path-provisioner is installed for storage management. Check here for more information.

Deploy ob-operator

Now, let’s see how to deploy the ob-operator using different methods!

Using YAML Configuration File

Deploy ob-operator in a Kubernetes cluster with the command below:

kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/2.2.2_release/deploy/operator.yaml

Using Helm Chart

The Helm Chart allows you to parameterize the namespace in which ob-operator is deployed. Follow these commands:

helm repo add ob-operator https://oceanbase.github.io/ob-operator
helm repo update
helm install ob-operator ob-operator --namespace=oceanbase-system --create-namespace --version=2.2.2

Using Terraform

For those who prefer Terraform, follow this method:

  1. Generate Configuration Variables:
  2. cd deploy/terraform
    ./generate_k8s_cluster_tfvars.sh
  3. Initialize Terraform:
  4. terraform init
  5. Apply Configuration:
  6. terraform apply

Verify Deployment

After the installation is complete, verify your deployment with:

kubectl get pod -n oceanbase-system

You should see your ob-operator pod running!

Deploy OceanBase Cluster

Before creating an OceanBase cluster, you need to create a secret to store the specific user’s password. Execute the following command:

kubectl create secret generic root-password --from-literal=password=root_password

Now, let’s deploy OceanBase:

kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/2.2.2_release/example/quickstart/obcluster.yaml

Wait for about 2 minutes, then check the status with:

kubectl get obclusters.oceanbase.oceanbase.com test

When the status shows “running,” your cluster is ready to go!

Connecting to the OceanBase Cluster

To connect to your OceanBase Cluster, first find the POD IP:

kubectl get pods -o wide

Then, use this command to connect:

mysql -h POD_IP -P2881 -uroot -proot_password oceanbase -A -c

OceanBase Dashboard

You can also manage your OceanBase using the OceanBase Kubernetes Dashboard. To install it, run the following commands:

helm repo add ob-operator https://oceanbase.github.io/ob-operator
helm repo update
helm install oceanbase-dashboard ob-operator/oceanbase-dashboard

Once installed, check the password using:

echo $(kubectl get -n default secret oceanbase-dashboard-user-credentials -o jsonpath=.data.admin | base64 -d)

Access the dashboard using the service type NodePort command:

kubectl get svc oceanbase-dashboard-oceanbase-dashboard

Project Architecture

ob-operator is built on top of kubebuilder and provides control and management of OceanBase clusters through a unified resource manager interface. It’s like a conductor leading an orchestra, ensuring that every section harmonizes perfectly to create a beautiful symphony of data management!

Troubleshooting

If you run into issues while using ob-operator, try the following troubleshooting ideas:

  • Ensure your Kubernetes cluster meets the prerequisites.
  • Double-check your YAML or Helm charts for any syntax errors.
  • Ensure all necessary resources like local-path-provisioner and cert-manager are correctly installed.
  • If issues persist, feel free to reach out through the GitHub Issue page or join the Official Forum.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Conclusion

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox