Free audit

View Audit Scope
TiDB on K8sTiDB Operator, multi-AZ Raft HA & NVMe/EBS engineering

TiDB on Kubernetes: TiDB Operator & Cloud-Native Ops

JusDB deploys and operates production TiDB on Kubernetes across Amazon EKS, Google GKE, Azure AKS, OpenShift, and bare-metal clusters. Database engineers configure the PingCAP TiDB Operator (TidbCluster, BackupSchedule, TidbMonitor, and TidbNGMonitoring CRDs), enforce zone-aware Placement Driver (PD) location labels, wire local NVMe or provisioned-IOPS EBS volumes for TiKV and TiFlash, and run leader-evicted rolling upgrades under your service agreement.

The first 30-minute call covers your databases, current ownership, and required coverage. No production access is needed. Or request a free audit of one database instance.

  • NDA before access
  • GitOps-ready TidbCluster CRDs
  • Written scope before work starts

TiDB Kubernetes architecture

Select a Kubernetes component

TidbCluster, BackupSchedule, TidbMonitor & TidbNGMonitoring

Production CRDs

Declarative lifecycle orchestration for PD, TiKV, TiDB, TiFlash, and TiCDC StatefulSets with automated Raft Leader eviction before pod restarts.

Inspect K8s operator states

Aligned with the PingCAP TiDB in Kubernetes documentation.

Kubernetes platforms
Amazon EKS, Google GKE, Azure AKS, Red Hat OpenShift, and bare-metal Kubernetes with local NVMe CSI
Initial-response targets
15 minutes for a critical (P1) incident under a 24x7 support agreement; 2 to 4 hours in business hours. See details
Coverage hours
Business hours (03:30–12:30 UTC) by default; 24x7 on-call available under a 24x7 support agreement

Selected clients

  • Innoviti
  • Blitz
  • Freecharge
  • Nango
  • Recochain
  • Screen Facts
  • Nexora
  • WeCredit

When teams call us

Common TiDB on Kubernetes failures we fix

We fix TiKV container OOMKills (Exit Code 137), AZ-blind Raft placement, ungraceful node drains, EBS WAL fsync stalls, dropped SQL connections during rollouts, and BR S3 permission failures.

Common TiDB on Kubernetes production symptoms and how JusDB engineers resolve them
SymptomWhat is usually happeningWhere we start
TIKV_CGROUP_OOM_137TiKV or TiFlash pods terminate with Exit Code 137 (OOMKilled)TiKV storage.block-cache.capacity defaults to 45% of physical node memory unless explicitly bounded to ~45% of the container memory limit.Explicitly set storage.block-cache.capacity in the TidbCluster CRD, enforce Guaranteed QoS (requests == limits), and cap tidb_mem_quota_query on TiDB pods.
AZ_BLIND_RAFT_QUORUMSingle availability zone outage takes down Raft quorum for some RegionsPD config lacks location-labels matching Kubernetes node labels (topology.kubernetes.io/zone), allowing 2 of 3 Raft Voters to land in the same AZ.Configure pd.config.replication.location-labels = ['topology.kubernetes.io/zone', 'kubernetes.io/hostname'] and enable tidb-scheduler topology spread.
UNGRACEFUL_TIKV_DRAINKarpenter or GKE node drain causes 10-second P99 latency spikesKubelet evicts a TiKV pod before the TiDB Operator admission webhook can drain Raft Region Leaders via PD evict-leader-scheduler.Enable the TiDB Operator admission webhook, set PodDisruptionBudgets, and pin stateful TiKV/PD node pools away from aggressive Spot consolidation.
EBS_WAL_FSYNC_LATENCYTiKV Raftstore append log latency exceeds 25ms on cloud volumesBaseline 3,000-IOPS EBS GP3 volumes share I/O between Raft Engine WAL fsyncs and heavy RocksDB background compactions.Provision dedicated raftdb/wal volumes or upgrade GP3 IOPS/throughput, enable TiKV rate-bytes-per-sec compaction pacing, or use local NVMe CSI.
TIDB_CONN_DROP_ROLLOUTRolling TiDB SQL pod deployment drops in-flight client transactionsTiDB pods terminate immediately on SIGTERM without waiting for the load balancer endpoint slice to deregister and active transactions to finish.Configure graceful-wait-before-shutdown in tidb.config, align terminationGracePeriodSeconds, and configure readiness probe preStop delays.
BR_IRSA_BACKUP_FAILScheduled BackupSchedule CRD jobs fail with S3 AccessDeniedBR backup pods run under a default ServiceAccount without AWS IRSA / EKS Pod Identity or GKE Workload Identity permissions for the S3/GCS bucket.Bind a dedicated IAM ServiceAccount to spec.backupTemplate.serviceAccount in the BackupSchedule CRD and verify PITR log backup continuity.

Response targets and escalation

How fast does JusDB respond to a TiDB Kubernetes incident?

Initial-response targets are 2 to 4 hours during covered business hours, Mon–Fri 09:00–18:00 IST (UTC+5:30). Where your service agreement includes 24x7 on-call, the initial-response target for P1 incidents is 15 minutes. Targets are not resolution guarantees. Standard business hours run 03:30–12:30 UTC.

Published initial-response targets by severity

  • 2 to 4 hours

    Business hours

    During covered business hours

  • 15 minutes

    24x7 on-call

    P1 incidents

SeverityInitial responseDefinitionChannel & coverage
P1 · Critical15 minutesProduction database down, primary unreachable, data corruption risk, or active failover event.24x7 on-call (under your service agreement) · Direct PagerDuty, Opsgenie, or phone page plus incident bridge
P2 · High30 minutesSevere latency spike, replication lag climbing rapidly, connection exhaustion, or degraded HA node.24x7 on-call (under your service agreement) · On-call alert plus shared Slack or Teams channel
P3 · Medium60 minutesNon-critical slow query regression, staging issue, backup warning, or replication check alert.24x7 on-call (under your service agreement) · Shared Slack or Teams channel or support ticket
P4 · Low90 minutesConfiguration question, index advisory, planned schema review, or general operational request.24x7 on-call (under your service agreement) · Shared Slack or Teams channel or support ticket

Our engineering team is in India; business-hours coverage is Mon–Fri 09:00–18:00 IST (UTC+5:30), and 24x7 on-call is available under your service agreement.

Initial-response targets, not resolution guarantees. The target for your engagement is set in your service agreement.

What happens when a P1 Kubernetes incident pages

  1. Page

    Direct alert to the on-call TiDB & Kubernetes engineer

    No tier-1 queue; immediate triage under your service agreement.

  2. Inspect

    Read-only TidbCluster, PD, TiKV, and kubelet diagnostics

    Correlate pod events, cgroup OOMs, PD store states, and hot Regions.

  3. Stabilize

    Restore Raft quorum, evict degraded leaders, or cap memory

    Execute pd-ctl operator commands or adjust TidbCluster limits safely.

  4. Harden

    Written post-incident review and TidbCluster CRD pull request

    Permanent webhook, block-cache, and topology fixes committed to Git.

Scope of Kubernetes engineering

What does TiDB on Kubernetes consulting & operations cover?

We deliver hardened TidbCluster CRDs, multi-AZ PD location-labels, NVMe/EBS StorageClasses, cgroup block-cache tuning, BackupSchedule S3 PITR, and leader-evicted upgrades.

  • TiDB Operator & TidbCluster CRD design

    We author production TidbCluster, TidbMonitor, TidbNGMonitoring, and BackupSchedule manifests managed through Helm, Kustomize, or ArgoCD.

    • Separate node pools and tolerations for PD, TiKV, TiDB, TiFlash, and TiCDC
    • Admission webhooks and tidb-scheduler for Raft-aware pod lifecycle hooks

    tidb-operator · TidbCluster CRD · Helm / ArgoCD · Webhooks

    Explore TiDB consulting services
  • Multi-AZ PD location-labels & Raft safety

    Ensure that every 96 MB Region places its 3 Raft Voters across 3 distinct availability zones so your cluster survives a full AZ failure.

    • Mapping topology.kubernetes.io/zone and hostname into PD location-labels
    • Strict PodDisruptionBudgets and topologySpreadConstraints for PD and TiKV

    PD Location Labels · TopologySpread · PodDisruptionBudget

    TiDB's Raft-based replication
  • Local NVMe CSI & EBS GP3/io2 storage

    Configure storage classes and XFS/ext4 mount options (`nodelalloc`, `noatime`) tailored for TiKV RocksDB and TiFlash columnar workloads.

    • Local NVMe CSI with PD max-store-down-time auto-healing on bare metal / i3en
    • High-IOPS EBS GP3 / PD-SSD PVC sizing with online volume expansion

    Local NVMe CSI · EBS GP3 / io2 · XFS nodelalloc · PVC Expansion

  • Cgroup memory & RocksDB block-cache tuning

    Eliminate container Exit Code 137 OOMKills by aligning TiKV, TiDB, and TiFlash internal memory trackers with Kubernetes cgroup limits.

    • Explicit storage.block-cache.capacity and memory-usage-limit in TiKV config
    • Guaranteed QoS pod specs and TiDB Server memory-quota guardrails

    storage.block-cache.capacity · Guaranteed QoS · Cgroup v2

  • BackupSchedule (BR) & S3 PITR automation

    Automate daily full SST snapshots and continuous KV log backups to S3, GCS, or Azure Blob Storage using Kubernetes-native CRDs.

    • Credential-free S3/GCS access via AWS IRSA, Pod Identity, or Workload Identity
    • Automated Restore CRD drills into isolated Kubernetes namespaces

    BackupSchedule CRD · Log Backup PITR · Restore CRD · IRSA

  • Leader-evicted upgrades & Remote DBA ops

    Execute non-disruptive TiDB version upgrades and hand over day-2 monitoring and incident response under your service agreement.

    • Webhook-orchestrated PD leader eviction before every TiKV pod restart
    • 24x7 P1 incident response available under a 24x7 support agreement

    TidbMonitor · Prometheus · Grafana · PagerDuty

    Explore TiDB Remote DBA services

Operator orchestration and written evidence

How TiDB Operator orchestrates Raft on Kubernetes

Explore how TidbCluster CRDs, admission webhooks, and PD location-labels manage multi-AZ Raft quorums, rolling upgrades, and online horizontal scaling.

TiDB Kubernetes Operator operational states

Select a state to inspect pod topology, webhook leader eviction, and scaling.

Service and Raft coordination path

AWS NLB / K8s Service -> TiDB SQL Pods -> Local-AZ PD TSO & TiKV Region Leaders

Zone-aware Raft HA
  • PD StatefulSet (3 AZs)

    tc-pd-0..2 (location-labels: zone, host)

    Schedules Region replicas across 3 AZs

  • TiKV StatefulSet (6 Pods)

    tc-tikv-0..5 (Guaranteed QoS, capped block-cache)

    1 Voter per AZ for every 96 MB Region

  • TiDB + TiFlash Pools

    tc-tidb-0..2 (SQL) + tc-tiflash-0..1 (MPP)

    Isolated node pools for OLTP vs HTAP

The TidbCluster CRD deploys 3 PD pods, 6 TiKV pods, 3 TiDB SQL pods, and 2 TiFlash pods across 3 availability zones. PD reads Kubernetes node labels to spread Raft Voters.

Example written finding from an EKS TidbCluster OOM & AZ topology auditSample deliverable

Finding

Uncapped RocksDB block-cache on 64 GiB EKS nodes triggers TiKV OOMKills

32 GiB tc-tikv pods ran on 64 GiB EKS worker nodes without storage.block-cache.capacity set, causing TiKV to allocate a 28.8 GiB block cache (45% of host RAM) and exceed its 32 GiB cgroup limit. Capping block-cache at 14 GiB and adding PD zone labels stabilized the cluster.

TiKV OOM restarts9 / wk → 0
AZ quorum compliance3-AZ verified

1. Read-only check of PD store labels and memory usage

kubectl exec -n tidb tc-pd-0 -- /pd-ctl store \
  | jq '.stores[] | {id: .store.id, address: .store.address, labels: .store.labels}'

2. Hardened TidbCluster CRD snippet for PD & TiKV

spec:
  pd:
    replicas: 3
    config: |
      [replication]
        location-labels = ["topology.kubernetes.io/zone", "kubernetes.io/hostname"]
        max-replicas = 3
  tikv:
    replicas: 6
    requests: { cpu: "8", memory: "32Gi", storage: "1Ti" }
    limits:   { cpu: "8", memory: "32Gi" }
    config: |
      [storage.block-cache]
        capacity = "14GB"

Your team and ours

How responsibilities divide for TiDB on Kubernetes

Managed cloud databases automate much of the infrastructure layer, but your team still owns query performance, capacity, cost, and incident decisions.

Shared responsibility for TiDB on Kubernetes versus TiDB Cloud
AreaTiDB Cloud DedicatedYour own EKS, GKE, AKS, or OpenShift with JusDB
TiDB Operator CRDs, admission webhooks, and node pool sizingTiDB Cloud manages its own underlying Kubernetes control plane.JusDB authors and maintains your TidbCluster, BackupSchedule, and TidbMonitor CRDs in Git.
PD location-labels and multi-AZ Raft quorum placementPre-configured on TiDB Cloud Dedicated.JusDB maps Kubernetes zone/rack labels into PD and verifies 3-AZ Region replica distribution.
TiKV block-cache sizing and Exit Code 137 OOMKill preventionManaged cloud presets container memory, though runaway SQL can still OOM TiDB nodes.JusDB calibrates storage.block-cache.capacity, Guaranteed QoS, and tidb_mem_quota_query.
Local NVMe CSI vs EBS GP3/io2 storage and XFS tuningAbstracted behind fixed cloud storage tiers.JusDB configures XFS nodelalloc StorageClasses, local NVMe provisioners, or high-IOPS EBS volumes.
BackupSchedule S3 PITR and leader-evicted rolling upgradesBackups and maintenance follow vendor schedules.JusDB wires IRSA S3 backups, runs Restore CRD drills, and executes rolling LTS upgrades.

Your team keeps control

  • Set business priorities, application requirements, and release plans
  • Approve production changes, except routine actions you have pre-approved
  • Own your cloud accounts, access policies, and vendor relationships
  • Decide when maintenance can happen and how quickly service must recover
  • Move the work in-house or to another provider after your agreement's notice period, with your data returned or deleted and the transition help your agreement sets out (Terms, section 8)

JusDB handles the agreed Kubernetes & TiDB work

  • Monitor database health, investigate alerts, and involve the right people
  • Review query performance, replication, capacity, and backup health
  • Carry out approved changes and update the operating instructions they affect
  • Report completed work, open risks, and recommended next steps

Supported Kubernetes platforms

Compare options

How JusDB TiDB on Kubernetes compares with SaaS and DIY Operator setups

Run TiDB inside your own cloud VPC on Reserved/Spot instances without SaaS compute markups or the risk of unguarded DIY TidbCluster manifests.

Evaluation Vector
JusDB DBRE
In-House DBALegacy AgencyDeveloper Generalist
TiDB Operator Architecture & TidbCluster CRD TuningDeploys official TiDB Operator with fine-tuned TidbCluster CRD manifests, granular component resource allocations, sysctl kernel parameters, and automated controller reconciliations across heterogeneous node groups.Deploys generic community Helm charts without configuring component-specific CRD parameters, leading to operator reconciliation loops and misconfigured controller states.Treats TiDB components as generic stateless workloads or standard StatefulSets, bypassing the TiDB Operator lifecycle automation and breaking automated self-healing.Deploys all components in a single default namespace using basic manifests, lacking topology spread constraints and proper service account RBAC isolation.
Dedicated Local NVMe Storage Classes for TiKV/TiFlashProvisions dedicated local NVMe storage classes via sig-storage-local-static-provisioner with tuned ext4/XFS mount options, delivering sub-millisecond Raft WAL sync latencies and high-IOPS RocksDB compaction.Mounts standard cloud network block storage (EBS/gp3) with burstable IOPS, causing severe Raft commit latency spikes and cascading store disconnection events during write spikes.Shares network-attached NFS or shared cluster storage across TiKV pods, violating multi-Raft consistency guarantees and triggering filesystem corruption warnings.Uses ephemeral container root disks without persistent volume claims, risking catastrophic data loss upon pod restarts or worker node rescheduling.
Placement Driver (PD) Multi-AZ Quorum IsolationArchitects a dedicated 3-node or 5-node PD quorum spread across separate availability zones with pod anti-affinity, tuned Raft election ticks, and prioritized network routes to keep TSO timestamp generation available.Schedules all PD replicas on the same Kubernetes worker node or single failure domain, causing complete cluster-wide metadata paralysis when that single node reboots.Runs an even number of PD replicas or mixes PD with heavy compute pods, leading to split-brain voting deadlocks during network partitions.Exposes PD etcd ports directly across cluster networks without mutual TLS (mTLS) or network policies, compromising cluster consensus security.
PodDisruptionBudgets (PDB) & Anti-Affinity HardeningEnforces strict PodDisruptionBudgets (maxUnavailable: 1), zone-level topologySpreadConstraints, and node anti-affinity for TiKV and PD pods, ensuring voluntary node drains and cluster auto-scaling never breach Raft quorum.Omits PodDisruptionBudgets, allowing automated cluster upgrades or node autoscalers to terminate multiple TiKV stores simultaneously and causing region peer unavailabilities.Configures soft anti-affinity that collapses during node shortages, placing multiple TiKV leader replicas onto a single overloaded Kubernetes hypervisor.Ignores eviction tolerances and drain mechanics, resulting in sudden pod eviction cascades whenever worker nodes hit transient memory pressure.
Rolling Stateful UpgradesOrchestrates phased rolling upgrades using TiDB Operator partition-based update strategies, automated TiKV region leader eviction prior to pod termination, and health check gates designed to prevent transaction loss.Performs uncoordinated kubectl rollout restarts, forcibly terminating TiKV stores with active leader leases and causing client connection aborts and multi-second query stalls.Schedules full-cluster maintenance windows for minor patch updates, taking down business-critical HTAP applications for hours.Updates container image tags simultaneously across all StatefulSets without verifying schema or storage engine backward compatibility, corrupting Raft state machines.
Cloud-Native Prometheus, Grafana & Chaos Mesh TestingIntegrates TidbMonitor with Prometheus operator, deploys curated Grafana dashboards with TiKV raft-engine and PD TSO alerts, and validates cluster resilience using automated Chaos Mesh fault-injection pipelines.Relies on generic Kubernetes node-exporter metrics, lacking visibility into TiKV Coprocessor queue depths, RocksDB write stalls, or TiFlash delta-layer merges.Installs ad-hoc logging agents without central telemetry aggregation, forcing reactive troubleshooting only after production outages have already impacted users.Runs synthetic load tests in staging without chaos engineering or failure injection, discovering quorum split and CSI volume unmount deadlocks only in production.

For procurement and security

NDA first, GitOps-native delivery, and written scope

All TidbCluster, BackupSchedule, and TidbMonitor CRDs are delivered as pull requests to your Git repository. Your platform team keeps cluster-admin control.Raguraman, Engineering Manager · Allen D, Lead Database SRE
  • Mutual NDA
  • Written statement of work
  • Named engineers
  • Least-privilege RBAC
  • NDA before access

    Signed before any Kubernetes or TiDB cluster inspection.

  • Written agreement

    Namespace scope, SLO targets, and deliverables defined in writing.

  • Namespace-scoped RBAC

    Read-only kubectl and SQL access by default through your bastion or VPN.

  • Manifests you keep

    Every TidbCluster manifest, BackupSchedule, and runbook stays in your repository. Meet the JusDB team.

JusDB's security practices are aligned with ISO 27001 and SOC 2 Type II, and JusDB is pursuing both certifications (see Terms, section 12). Read the stated status.

FAQ

Common TiDB on Kubernetes questions

Answers on the TiDB Operator admission webhook, TiKV Exit Code 137 OOMKills, multi-AZ PD location-labels, NVMe vs EBS storage, and BR S3 backups.

Still have a question?

Ask it on a scoping call. No production access needed.

Book a 30-min scoping call (opens Google Calendar in a new tab)

How does the TiDB Operator safely restart TiKV pods without causing write errors?

When the TiDB Operator admission webhook is enabled, any attempt to delete or upgrade a TiKV pod is intercepted. The Operator first instructs Placement Driver (PD) to add an evict-leader-scheduler for that TiKV store, transferring all Raft Region Leaders to healthy peer pods. Only after the store's leader count drops to zero does Kubernetes terminate the pod.

Why do TiKV pods get OOMKilled (Exit Code 137) on Kubernetes?

If storage.block-cache.capacity is not explicitly set in the TidbCluster CRD, TiKV may size its RocksDB block cache based on the physical Kubernetes worker node's RAM rather than the pod's container limit, or leave too little headroom for Raftstore, page cache, and Coprocessor memory. We set Guaranteed QoS and cap block-cache.capacity to 40-45% of the container memory limit.

How do we make TiDB survive a full Availability Zone outage on EKS, GKE, or AKS?

We configure pd.config.replication.location-labels to match Kubernetes node topology labels (['topology.kubernetes.io/zone', 'kubernetes.io/hostname']) and spread at least 3 PD pods and 6 TiKV pods across 3 availability zones. PD then enforces that each 96 MB Region places its 3 Raft Voters in 3 separate AZs.

Should we use EBS GP3/PD-SSD or local NVMe SSDs for TiKV on Kubernetes?

Both are supported in production. High-throughput EBS GP3 / io2 or GCP PD-SSD PersistentVolumeClaims simplify pod rescheduling because storage is network-attached. For ultra-low sub-5ms P99 write latency, local NVMe instance store disks (e.g., AWS i3en/i4i) with local-volume CSI deliver maximum IOPS, relying on TiKV's 3-way Raft replication to heal data if an instance fails.

How do we prevent dropped client connections when rolling TiDB SQL pods?

We set graceful-wait-before-shutdown (e.g., 15-30 seconds) in the TiDB configuration alongside a matching Kubernetes preStop hook and terminationGracePeriodSeconds. When a TiDB pod prepares to stop, its health check fails immediately so the load balancer stops sending new connections while in-flight SQL transactions finish cleanly.

How do automated backups and Point-in-Time Recovery (PITR) work on Kubernetes?

We deploy the BackupSchedule custom resource alongside a continuous Log Backup task using TiDB Backup & Restore (BR). Every TiKV pod streams SST snapshots and KV transaction logs directly to S3, GCS, or Azure Blob Storage via IAM Roles for Service Accounts (IRSA) or Workload Identity.

How fast does JusDB respond to a P1 TiDB Kubernetes outage?

Initial-response targets are 2 to 4 hours during covered business hours, Mon–Fri 09:00–18:00 IST (UTC+5:30). Where your service agreement includes 24x7 on-call, the initial-response target for P1 incidents is 15 minutes. Targets are not resolution guarantees.

Can JusDB audit our existing TidbCluster YAML manifests before we go live?

Yes. Under a mutual NDA, we review your TidbCluster, TidbMonitor, and BackupSchedule manifests, storage classes, kernel sysctls, and PD topology labels, delivering a written hardening report and Git pull request.

TiDB playbooks and guides

TiDB architecture, migration, and Kubernetes guides

Engineering guides from our blog and related TiDB service pages.

Next step

Talk to a TiDB engineer about your Kubernetes cluster

Tell us which Kubernetes platform and storage classes you run and what stability or scaling goals you want covered. The first 30-minute call covers your databases, current ownership, and required coverage. No production access is needed. Or request a free audit of one database instance, subject to availability: mutual NDA before read-only access, a prioritized report within one week after access is ready, and no obligation.

NDA before access · read-only by default · written scope first

Related TiDB Services

Explore more ways our TiDB experts can help with your database infrastructure.