Parts 1 to 3 covered concepts, tenants and SQL, and high availability — mostly principles plus local experimentation. This final part lands on our real environment: Kubernetes + OceanBase. How do you run the cluster and tenants on K8s, how do you back them up, and how do you tell whether things are healthy? This closes out the series.

Final set of notes. With K8s and backup I’m mostly “working through the docs” — hands-on experience is still ahead of me — so this leans toward principles and the shape of the solution. Treat any concrete YAML or commands as subject to the version you’re running.


1. Running OB on K8s: ob-operator

There is an official OceanBase Database Operator (ob-operator), a Kubernetes CRD controller. You declare custom resources like OBCluster and OBTenant in YAML, and the operator brings up observers, forms the cluster, creates tenants and handles day-to-day operations — no more logging onto boxes to docker run or drive obd by hand.

A few correspondences worth memorising:

  • An OB Zone maps onto a Kubernetes topology domain (node pool / availability zone). In other words, OB’s “cross-Zone disaster recovery” becomes “deploy across AZs” on K8s — the operator aligns Zones with node availability zones.
  • Each OBServer is usually one Pod (commonly managed as a set, with its own persistent volume).
  • Our production K8s + OB setup is, in all likelihood, running in exactly this ob-operator style.

Side note: besides the operator there’s OBD (OceanBase Deployer), which is the deployment tool for bare metal / VMs. For Kubernetes, reach for ob-operator — don’t mix them up.

Here’s the whole chain drawn out:

Running OceanBase on Kubernetes with ob-operator

ob-operator manages cluster and tenants declaratively; Zones align with K8s availability zones; backups go to object storage; metrics feed monitoring.


2. Backup and restore

I initially oversimplified this — I assumed “just mysqldump it, like MySQL.” It doesn’t work that way: in a distributed database, physical backup plus log archiving is the real answer, otherwise you cannot guarantee a consistent point-in-time restore.

OB’s approach:

  • Data backup: the baseline data (SSTables) is backed up physically — typically a weekly full backup plus daily incrementals.
  • Log backup (archiving): redo logs are archived continuously. This must be enabled; without it you can only restore to the most recent backup point and every transaction in between is gone.
  • Point-in-time recovery (PITR): from one full backup plus the archived logs after it, you can roll forward to an arbitrary point in time.
  • The backup target is usually object storage: OSS / S3 / COS and friends — on K8s you configure bucket credentials.

So the correct posture is the trio of full + incremental + continuous log archiving. Lose any one of them and you cannot do a clean restore.


3. Observability and troubleshooting

OB ships a rich set of system views, and troubleshooting basically orbits them:

  • The DBA_OB_* family: cluster / tenant / server / Unit level — e.g. DBA_OB_TENANTS, DBA_OB_SERVERS (whether each OBServer is active), DBA_OB_UNITS.
  • The GV$* / V$* family: processes, sessions, SQL statistics — e.g. GV$OB_PROCESSES, V$SQL, slow SQL and execution plans.
  • Resource usage (whether a tenant is saturated) and whether log stream leaders are evenly distributed (i.e. whether primary_zone is actually doing what you intended) are all visible from these views.

For monitoring, OB has an exporter; the common pairing is Prometheus + Grafana to pull metrics into dashboards and alerts.

The troubleshooting order I wrote down for myself: check service and Zone status first → then whether tenant resources are saturated → then slow SQL and data distribution → finally whether log stream leaders are balanced. Following that order keeps me from flailing.


4. A few reminders for a K8s + OB stack

  • Zones must be aligned with real availability zones. Otherwise “cross-site disaster recovery” is only nominal: if a whole data center dies and OB has no majority left, high availability is a slogan.
  • ob-operator manages the cluster, but backup and monitoring are yours to wire up. The object-storage archive bucket and Prometheus scraping are not in the operator’s default scope.
  • Multi-tenancy really does isolate, but under-provision and tenants fight each other. Plan Unit specs and primary_zone up front; don’t discover after go-live that one tenant is eating all the CPU and dragging its neighbours down.

5. Closing the series

The four parts walked this path:

  1. Concepts + running it locally: OB is natively distributed, Shared-Nothing, single observer process, MySQL/Oracle compatible, LSM-Tree storage.
  2. Tenants / resources / SQL in practice: Cluster→Tenant→Database→Table, with Unit/Pool as the resource vehicle, a three-step tenant creation, and partitioning deciding data distribution.
  3. High availability and elasticity: log stream Paxos majority plus lease-based split-brain protection, locality/primary_zone controlling replicas and leaders, scaling handled by RootService’s automatic rebalancing.
  4. Production (this part): declarative management on K8s via ob-operator, backup based on physical backup + log archiving to object storage for PITR, and observability through DBA_OB_* / GV$ views plus Prometheus.

From “what even is a distributed database” to “not panicking in front of the production cluster” — that road is walked. Once I’ve actually operated it and collected some real scars, I’ll come back with a hands-on follow-up.

References: