New to KubeDB? Please start here.
HanaDB
What is HanaDB
HanaDB is a Kubernetes Custom Resource Definition (CRD). It provides a declarative configuration for
SAP HANA in a Kubernetes native way. You
only need to describe the desired database configuration in a HanaDB object, and the KubeDB operator
will create Kubernetes objects in the desired state for you.
HanaDB Spec
As with all other Kubernetes objects, a HanaDB needs apiVersion, kind, and metadata fields. It
also needs a .spec section. Below is an example of a HanaDB object describing a System Replication
cluster.
apiVersion: kubedb.com/v1alpha2
kind: HanaDB
metadata:
name: hanadb-cluster
namespace: demo
spec:
version: "2.0.82"
replicas: 2
storageType: Durable
topology:
mode: SystemReplication
systemReplication:
replicationMode: fullsync
operationMode: logreplay_readaccess
authSecret:
kind: Secret
name: hanadb-cluster-auth
configuration:
secretName: hanadb-configuration
tls:
issuerRef:
apiGroup: cert-manager.io
kind: Issuer
name: hdb-ca-issuer
monitor:
agent: prometheus.io/operator
prometheus:
exporter:
port: 9668
serviceMonitor:
labels:
release: prometheus
podTemplate:
spec:
containers:
- name: hanadb
resources:
requests:
cpu: "1500m"
memory: "8Gi"
limits:
cpu: "4"
memory: "14Gi"
storage:
storageClassName: local-path
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 64Gi
deletionPolicy: WipeOut
spec.version
spec.version is a required field specifying the name of the HanaDBVersion
CRD where the docker images are specified. To list the available HanaDBVersion objects:
kubectl get hanadbversions
spec.replicas
spec.replicas is an optional field that specifies the number of database instances (pods). It
defaults to 1.
- For a Standalone database (no
spec.topology), keepreplicas: 1. - For a SystemReplication cluster,
spec.replicasis the total number of HANA nodes and must be>= 2. Whenspec.replicasis even, KubeDB automatically adds an arbiter pod (a lightweight raft tie-breaker that does not run the HANA database) so the cluster can elect a primary.
spec.topology
spec.topology selects the deployment mode. When spec.topology is omitted, the database runs as a
single Standalone instance.
spec.topology.mode— one ofStandaloneorSystemReplication.spec.topology.systemReplication.replicationMode— HANA System Replication mode. One ofsync,syncmem,async, orfullsync. Defaults tosync.spec.topology.systemReplication.operationMode— HANA operation mode. One oflogreplay,delta_datashipping, orlogreplay_readaccess. Defaults tologreplay. Uselogreplay_readaccessto allow read-only queries on the secondary; in that case KubeDB also creates a dedicatedsecondary-<name>Service.
spec.storageType
spec.storageType is an optional field that can be Durable (default) or Ephemeral.
Durable— the database uses aPersistentVolumeClaimcreated fromspec.storage.Ephemeral— the database uses anemptyDirvolume; data is lost when the pod restarts. HANA is disk-heavy, soEphemeralis only suitable for throwaway testing.
spec.storage
When spec.storageType is Durable, spec.storage defines the PVC for the HANA data volume
(/hana/mounts):
spec.storage.storageClassName— the name of theStorageClassto use.spec.storage.accessModes— usually["ReadWriteOnce"].spec.storage.resources.requests.storage— requested volume size. HANA is disk-heavy; use a realistic size (the guides use64Gi).
spec.authSecret
spec.authSecret is an optional field referencing the Secret that holds the HANA SYSTEM user
credentials. If omitted, KubeDB creates a secret named <name>-auth with an auto-generated password.
The secret has type kubernetes.io/basic-auth with the following keys:
username— alwaysSYSTEM.password— the SYSTEM database password.password.json—{"master_password":"<password>"}, the format consumed by the HANA container.
The HANA username must remain
SYSTEM. See Rotate Authentication for changing the password safely.
spec.configuration
spec.configuration lets you supply a custom HANA global.ini:
spec.configuration.secretName— name of aSecretwhoseglobal.inikey holds the configuration.spec.configuration.applyConfig— an inlinemap[string]stringkeyed byglobal.ini.
See Custom Configuration. At runtime, custom
configuration is merged into HANA’s global.ini.
spec.tls
spec.tls configures TLS using cert-manager. When set, spec.tls.issuerRef
is required and must reference a cert-manager Issuer or ClusterIssuer. KubeDB provisions three
certificates with the aliases server, client, and metrics-exporter. See TLS/SSL Encryption.
spec.monitor
spec.monitor enables Prometheus metrics through the bundled hanadb_exporter. Set
spec.monitor.agent to prometheus.io/builtin or prometheus.io/operator. See
Monitoring.
spec.podTemplate
spec.podTemplate customizes the pods that run the database. The most common use is setting resources
on the named containers. A HanaDB pod can run these containers:
hanadb— the SAP HANA database (always present).hanadb-coordinator— the raft coordinator sidecar (present only forSystemReplicationclusters; it elects the primary and labels pods).exporter— the Prometheus exporter (present only whenspec.monitoris set).
spec.deletionPolicy
spec.deletionPolicy controls what happens to the data and auxiliary objects when the HanaDB object
is deleted:
| Value | PetSet / Pods | PVC | Auth & config secrets |
|---|---|---|---|
DoNotTerminate | blocks delete | — | — |
Halt | deleted | kept | kept |
Delete | deleted | deleted | kept |
WipeOut | deleted | deleted | deleted |
Delete is the default. For more details, see this blog post.
spec.healthChecker
spec.healthChecker tunes how KubeDB probes the database (defaults: periodSeconds: 20,
timeoutSeconds: 10, failureThreshold: 3). Setting spec.healthChecker.disableWriteCheck: true
keeps the periodic write probe from creating its bookkeeping tenant database/table.
HanaDB Status
spec.status.phase reflects the overall state of the database and is one of:
Provisioning, DataRestoring, Ready, Critical, NotReady, Halted, or Unknown.
KubeDB derives the phase from the status.conditions array (for example ProvisioningStarted,
ReplicaReady, AcceptingConnection, Ready, and Provisioned).
Next Steps
- Deploy a Standalone HanaDB.
- Deploy a System Replication cluster.
- Learn about HanaDBVersion and HanaDBOpsRequest.































