OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

Kubernetes operator for OceanBase

V2.3.1Community Edition

  • Overview
  • Quick start
  • Deploy
  • Upgrade
  • User guide
    • Cluster management
      • Manage clusters
      • Create a cluster
      • Zone management
        • Add zones to a cluster
        • Delete zones from a cluster
      • Server management
        • Add OBServer nodes to zones
        • Delete OBServer nodes from zones
      • Upgrade a cluster
      • Manage parameters
      • Update resources
      • Delete a cluster
    • Tenant management
      • Manage tenants
      • Create a tenant
      • Modify tenant
        • Manage resources
        • Manage replicas
        • Modify other parameters
      • Delete a tenant
      • Perform tenant O&M operations
    • High availability
      • High availability
      • Recover from node failure
      • Back up a tenant
      • Restore data from a backup
      • Physical standby tenant
      • Inter K8s cluster management
  • Configure
  • Appendix
    • Deploy OceanBase Database and web app in a Kubernetes cluster
    • FAQ
  • Changelog

Download PDF

Overview Quick start Deploy Upgrade Manage clusters Create a cluster Upgrade a cluster Manage parameters Update resources Delete a cluster Manage tenants Create a tenant Delete a tenant Perform tenant O&M operations High availability Recover from node failure Back up a tenant Restore data from a backup Physical standby tenant Inter K8s cluster management Configure Deploy OceanBase Database and web app in a Kubernetes cluster FAQ Changelog
OceanBase logo

The Unified Distributed Database for the AI Era.

Follow Us
Products
OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
Resources
DocsBlogLive DemosTraining & Certification
Company
About OceanBaseTrust CenterLegalPartnerContact Us
Follow Us

© OceanBase 2026. All rights reserved

Cloud Service AgreementPrivacy PolicySecurity
Contact Us
Document Feedback
  1. Documentation Center
  2. Kubernetes operator for OceanBase
  3. V2.3.1
iconKubernetes operator for OceanBase
V 2.3.1Community Edition
Community Edition
  • V 2.3.1
  • V 2.3.0
  • V 2.2.0
  • V 2.1.2
  • V 2.1.1
  • V 2.1.0

Deploy OceanBase Database and web app in a Kubernetes cluster

Last Updated:2025-11-28 06:07:04  Updated
share
What is on this page
Prerequisites
Deploy OceanBase Database and related components
Preparations before deployment
Deploy ob-configserver
Deploy an OceanBase cluster
Deploy ODP
Deploy applications
Create a tenant
Deploy an application
Deploy the monitoring system
Deploy Prometheus
Deploy Grafana
Summary
Note

folded

share

This topic describes how to deploy OceanBase Database, related components, and applications in a Kubernetes cluster by using a real-world example.

Prerequisites

Before you start the deployment, make sure that you have deployed cert-manager, local-path-provisioner, and ob-operator in your Kubernetes cluster.

In this example, the following components are deployed:

  • OceanBase Database.
  • ob-configserver, which is used to register the IP address of the RootService server for OceanBase Database.
  • OceanBase Database Proxy (ODP), the proxy of OceanBase Database.
  • OceanBase Todo List. An extremely simple web application taken as an example to describe how to deploy web applications and use OceanBase cluster as backend database in the Kubernetes cluster.
  • Prometheus, the monitoring and alerting system that collects and calculates the monitoring metrics of OceanBase Database.
  • Grafana, the data visualization system. You can connect Grafana to Prometheus to display the monitoring data of OceanBase Database.

Deploy OceanBase Database and related components

Preparations before deployment

Create a namespace:

kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/stable/example/webapp/namespace.yaml

View the created namespace:

kubectl get namespace oceanbase

The following output indicates that the namespace is created:

NAME        STATUS   AGE
oceanbase   Active   98s

Create secrets for the cluster and tenants:

kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/stable/example/webapp/secret.yaml

View the created secrets:

kubectl get secret -n oceanbase

The following output indicates that the secrets are created:

NAME                      TYPE                                  DATA   AGE
sc-metatenant-root        Opaque                                1      11s
sc-metatenant-standbyro   Opaque                                1      11s
sc-sys-monitor            Opaque                                1      11s
sc-sys-operator           Opaque                                1      11s
sc-sys-proxyro            Opaque                                1      11s
sc-sys-root               Opaque                                1      11s

Deploy ob-configserver

ob-configserver allows you to register, store, and query metadata of the RootService server for OceanBase Database. The supported metadata storage types are sqlite3 and mysql. In this example, sqlite3 is used. Run the following command to deploy ob-configserver and create the corresponding service:

kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/stable/example/webapp/configserver.yaml

Check the pod status:

kubectl get pods -n oceanbase | grep ob-configserver

# desired output
ob-configserver-856bf5d865-dlwxr   1/1     Running   0          16s

Check the svc status:

kubectl get svc svc-ob-configserver -n oceanbase

# desired output
NAME                  TYPE       CLUSTER-IP   EXTERNAL-IP   PORT(S)          AGE
svc-ob-configserver   NodePort   10.96.3.39   <none>        8080:30080/TCP   98s

Deploy an OceanBase cluster

When you deploy an OceanBase cluster, add environment variables and set the system parameter obconfig_url to the IP address of ob-configserver service. OceanBase Database will register the information of RootService with ob-configserver. Deploy the OceanBase cluster:

kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/stable/example/webapp/obcluster.yaml

Run the following command to query the status of the OceanBase cluster until the status becomes running:

kubectl get obclusters.oceanbase.oceanbase.com metadb -n oceanbase

# desired output
NAME     STATUS    AGE
metadb   running   3m21s

Deploy ODP

You can start ODP by using ob-configserver or specifying the RS list. To maximize the performance of ODP, we recommend that you connect ODP to the cluster by using ob-configserver.

Run the following command to deploy ODP and create the ODP service:

kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/stable/example/webapp/obproxy.yaml

When you query the pod status of ODP, you can see two ODP pods.

kubectl get pod -A | grep obproxy

# desired output
oceanbase            obproxy-5cb8f4d975-pmr59                          1/1     Running   0          21s
oceanbase            obproxy-5cb8f4d975-xlvjp                          1/1     Running   0          21s

View information about the ODP service:

kubectl get svc svc-obproxy -n oceanbase

# desired output
NAME          TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)             AGE
svc-obproxy   ClusterIP   10.96.2.46   <none>        2883/TCP,2884/TCP   2m26s

Connect to the OceanBase cluster by using the IP address of the ODP service:

mysql -h${obproxy-service-address} -P2883 -uroot@sys#metadb -p

If the OceanBase cluster is connected, the ODP service is normal.

connection

If the cluster not exist message is returned, it indicates that the OceanBase cluster has not registered the cluster metadata with ob-configserver. Try again later. You can view the registration result by using the curl "http://127.0.0.1:30080/services?Action=ObRootServiceInfo&ObCluster=metadb" statement. If the RsList parameter is not empty in the response, the cluster metadata is registered.

Deploy applications

Create a tenant

You can create a dedicated tenant for each type of business for better resource isolation. In this example, one tenant is created.

Run the following command to create a tenant:

kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/stable/example/webapp/tenant.yaml

Run the following command to query the status of the tenant until the status becomes running:

kubectl get obtenants.oceanbase.oceanbase.com metatenant -n oceanbase
NAME         STATUS    TENANTNAME   TENANTROLE   CLUSTERNAME   AGE
metatenant   running   metatenant   PRIMARY      metadb        106s

Run the following command to verify that the tenant can be connected:

mysql -h${obproxy-service-address} -P2883 -uroot@metatenant#metadb -p

If the tenant is connected, you can use it.

Deploy an application

OceanBase Todo List is an extremely simple web application taken as an example to describe how to deploy web applications and use OceanBase cluster as backend database in the Kubernetes cluster.

Run the following command to create databases first:

# Connect to the tenant
mysql -h${obproxy-service-address} -P2883 -uroot@metatenant#metadb -p

# Create dev database
create database dev;

Run the following command to deploy the application:

kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/stable/example/webapp/oceanbase-todo.yaml

After the deployment process is completed, run the following command to view the application status:

# Check the pod
kubectl get pods -n oceanbase | grep oceanbase-todo
oceanbase-todo-746c7ff78f-49dxv       1/1     Running   0             12m
oceanbase-todo-746c7ff78f-4875t       1/1     Running   0             12m

# Check service
kubectl get svc svc-oceanbase-todo -n oceanbase
NAME                  TYPE       CLUSTER-IP     EXTERNAL-IP   PORT(S)           AGE
svc-oceanbase-todo    NodePort   10.43.39.231   <none>        20031:32080/TCP   12m

An application provides service a while after it is deployed. You can access the application by using the service address.

# Check service with the following command:
curl 'http://${service_ip}:${service_port}'

# Take Cluster IP 10.43.39.231 as an example
curl http://10.43.39.231:20031
# Desired output is as follows:
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/png" href="/logo.png" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>OceanBase Todo List</title>
    <script type="module" crossorigin src="/assets/index-DHbyEFSo.js"></script>
    <link rel="stylesheet" crossorigin href="/assets/index-B8po_uIp.css">
  </head>
  <body>
    <div id="root"></div>
  </body>
</html>

If you want to access the application from the Internet, you can use service of type NodePort to expose the application at a port on the K8s node. The NodePort is 32080 in this example. You can access the application on address: http://${node_ip}:32080.

Deploy the monitoring system

Deploy Prometheus

When you deploy the OceanBase cluster, an OBAgent sidecar container is created in each pod to provide monitoring data over the Prometheus protocol. A service is also created to automatically identify the IP address of OBAgent to collect data with the service discovery feature enabled.

Run the following command to deploy Prometheus:

kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/stable/example/webapp/prometheus.yaml

Run the following command to view the deployment status:

# check pod status
kubectl get pods -n oceanbase | grep prometheus
prometheus-576d7757b9-jsvfh        1/1     Running   0          3m17s

# check service status
kubectl get svc svc-prometheus -n oceanbase
NAME             TYPE       CLUSTER-IP    EXTERNAL-IP   PORT(S)          AGE
svc-prometheus   NodePort   10.96.1.212   <none>        9090:30090/TCP   3m45s

Deploy Grafana

Grafana displays the metrics of OceanBase Database by using Prometheus as a data source. Run the following command to deploy Grafana:

kubectl apply -f https://raw.githubusercontent.com/oceanbase/ob-operator/stable/example/webapp/grafana.yaml

Run the following command to view the deployment status:

# check pod status
kubectl get pods -n oceanbase | grep grafana
grafana-b7c6c6ccb-dkv57            1/1     Running   0          2m

# check service status
kubectl get svc svc-grafana -n oceanbase
NAME          TYPE       CLUSTER-IP    EXTERNAL-IP   PORT(S)          AGE
svc-grafana   NodePort   10.96.2.145   <none>        3000:30030/TCP   2m

Open a browser and visit the service address to view the monitoring metrics of OceanBase Database.

Grafana

Summary

This topic describes how to deploy OceanBase Database and related components such as ODP and ob-configserver, applications, and the monitoring system. You can deploy other applications based on the example.

Note

You can find all configuration files used in this topic in the webapp directory.

Previous topic

Configure
Last

Next topic

FAQ
Next
What is on this page
Prerequisites
Deploy OceanBase Database and related components
Preparations before deployment
Deploy ob-configserver
Deploy an OceanBase cluster
Deploy ODP
Deploy applications
Create a tenant
Deploy an application
Deploy the monitoring system
Deploy Prometheus
Deploy Grafana
Summary
Note