From 9e26ef98156d3aedfaed625b3cf777355dcebb5e Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Thu, 30 Apr 2026 11:09:53 +0600 Subject: [PATCH 1/5] docs(hanadb): add guides and examples Signed-off-by: ZobayerAbedin --- .../hanadb/quickstart/system-replication.yaml | 21 ++ docs/guides/hanadb/README.md | 64 +++++++ docs/guides/hanadb/_index.md | 10 + docs/guides/hanadb/concepts/_index.md | 10 + docs/guides/hanadb/concepts/catalog.md | 47 +++++ docs/guides/hanadb/concepts/hanadb.md | 54 ++++++ docs/guides/hanadb/concepts/opsrequest.md | 42 ++++ docs/guides/hanadb/configuration/_index.md | 10 + .../hanadb/configuration/using-config-file.md | 144 ++++++++++++++ docs/guides/hanadb/custom-rbac/_index.md | 10 + .../hanadb/custom-rbac/using-custom-rbac.md | 160 ++++++++++++++++ docs/guides/hanadb/monitoring/_index.md | 10 + docs/guides/hanadb/monitoring/overview.md | 39 ++++ .../monitoring/using-builtin-prometheus.md | 177 +++++++++++++++++ .../monitoring/using-prometheus-operator.md | 153 +++++++++++++++ docs/guides/hanadb/ops-request/_index.md | 10 + docs/guides/hanadb/ops-request/overview.md | 29 +++ docs/guides/hanadb/private-registry/_index.md | 10 + .../using-private-registry.md | 127 +++++++++++++ docs/guides/hanadb/quickstart/_index.md | 10 + docs/guides/hanadb/quickstart/quickstart.md | 88 +++++++++ docs/guides/hanadb/quickstart/rbac.md | 179 ++++++++++++++++++ 22 files changed, 1404 insertions(+) create mode 100644 docs/examples/hanadb/quickstart/system-replication.yaml create mode 100644 docs/guides/hanadb/README.md create mode 100644 docs/guides/hanadb/_index.md create mode 100644 docs/guides/hanadb/concepts/_index.md create mode 100644 docs/guides/hanadb/concepts/catalog.md create mode 100644 docs/guides/hanadb/concepts/hanadb.md create mode 100644 docs/guides/hanadb/concepts/opsrequest.md create mode 100644 docs/guides/hanadb/configuration/_index.md create mode 100644 docs/guides/hanadb/configuration/using-config-file.md create mode 100644 docs/guides/hanadb/custom-rbac/_index.md create mode 100644 docs/guides/hanadb/custom-rbac/using-custom-rbac.md create mode 100644 docs/guides/hanadb/monitoring/_index.md create mode 100644 docs/guides/hanadb/monitoring/overview.md create mode 100644 docs/guides/hanadb/monitoring/using-builtin-prometheus.md create mode 100644 docs/guides/hanadb/monitoring/using-prometheus-operator.md create mode 100644 docs/guides/hanadb/ops-request/_index.md create mode 100644 docs/guides/hanadb/ops-request/overview.md create mode 100644 docs/guides/hanadb/private-registry/_index.md create mode 100644 docs/guides/hanadb/private-registry/using-private-registry.md create mode 100644 docs/guides/hanadb/quickstart/_index.md create mode 100644 docs/guides/hanadb/quickstart/quickstart.md create mode 100644 docs/guides/hanadb/quickstart/rbac.md diff --git a/docs/examples/hanadb/quickstart/system-replication.yaml b/docs/examples/hanadb/quickstart/system-replication.yaml new file mode 100644 index 000000000..9a87c6fcb --- /dev/null +++ b/docs/examples/hanadb/quickstart/system-replication.yaml @@ -0,0 +1,21 @@ +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: hana-cluster + namespace: demo +spec: + version: "2.0.82" + replicas: 2 + storageType: Durable + topology: + mode: SystemReplication + systemReplication: + replicationMode: fullsync + operationMode: logreplay_readaccess + storage: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 64Gi + storageClassName: local-path diff --git a/docs/guides/hanadb/README.md b/docs/guides/hanadb/README.md new file mode 100644 index 000000000..7361de58d --- /dev/null +++ b/docs/guides/hanadb/README.md @@ -0,0 +1,64 @@ +--- +title: HanaDB +menu: + docs_{{ .version }}: + identifier: hanadb-readme + name: HanaDB + parent: hanadb-guides + weight: 10 +menu_name: docs_{{ .version }} +section_menu_id: guides +url: /docs/{{ .version }}/guides/hanadb/ +aliases: + - /docs/{{ .version }}/guides/hanadb/README/ +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# Overview + +KubeDB supports SAP HANA through the `HanaDB` CRD with standalone and system replication topology. + +## Supported HanaDB Features + +| Features | Availability | +|---------------------------------------------------------------|:------------:| +| Provisioning in Standalone mode | ✓ | +| Provisioning in System Replication mode | ✓ | +| Custom configuration and auth secret | ✓ | +| Non-root deployment customization | ✓ | +| Monitoring | ✓ | + +## Example HanaDB Manifest + +```yaml +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: hana-cluster + namespace: demo +spec: + version: "2.0.82" + replicas: 2 + storageType: "Durable" + topology: + mode: SystemReplication + systemReplication: + replicationMode: fullsync + operationMode: logreplay_readaccess + storage: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 64Gi + storageClassName: local-path +``` + +## User Guide + +- [Quickstart HanaDB](/docs/guides/hanadb/quickstart/quickstart.md) with KubeDB operator. +- [HanaDB CRD Concept](/docs/guides/hanadb/concepts/hanadb.md). +- [HanaDBVersion CRD Concept](/docs/guides/hanadb/concepts/catalog.md). +- [HanaDBOpsRequest CRD Concept](/docs/guides/hanadb/concepts/opsrequest.md). +- [Monitoring](/docs/guides/hanadb/monitoring/overview.md) for metrics collection guidance. +- [Ops Request](/docs/guides/hanadb/ops-request/overview.md). \ No newline at end of file diff --git a/docs/guides/hanadb/_index.md b/docs/guides/hanadb/_index.md new file mode 100644 index 000000000..fba9dbe97 --- /dev/null +++ b/docs/guides/hanadb/_index.md @@ -0,0 +1,10 @@ +--- +title: HanaDB +menu: + docs_{{ .version }}: + identifier: hanadb-guides + name: HanaDB + parent: guides + weight: 14 +menu_name: docs_{{ .version }} +--- \ No newline at end of file diff --git a/docs/guides/hanadb/concepts/_index.md b/docs/guides/hanadb/concepts/_index.md new file mode 100644 index 000000000..e0ea9f7b5 --- /dev/null +++ b/docs/guides/hanadb/concepts/_index.md @@ -0,0 +1,10 @@ +--- +title: HanaDB Concepts +menu: + docs_{{ .version }}: + identifier: hanadb-concepts + name: Concepts + parent: hanadb-guides + weight: 15 +menu_name: docs_{{ .version }} +--- \ No newline at end of file diff --git a/docs/guides/hanadb/concepts/catalog.md b/docs/guides/hanadb/concepts/catalog.md new file mode 100644 index 000000000..ff59b1f07 --- /dev/null +++ b/docs/guides/hanadb/concepts/catalog.md @@ -0,0 +1,47 @@ +--- +title: HanaDBVersion CRD +menu: + docs_{{ .version }}: + identifier: hanadb-catalog-concepts + name: HanaDBVersion + parent: hanadb-concepts-hanadb + weight: 15 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# HanaDBVersion + +## What is HanaDBVersion + +`HanaDBVersion` is the catalog CRD that maps a HanaDB version string to the container images and metadata used by KubeDB. + +KubeDB resolves `HanaDB.spec.version` through this catalog. + +## HanaDBVersion Specification + +```yaml +apiVersion: catalog.kubedb.com/v1alpha1 +kind: HanaDBVersion +metadata: + name: "2.0.82" +spec: + version: "2.0.82" + db: + image: "kubedb/hanadb:2.0.82" + deprecated: false +``` + +## Key fields + +- `metadata.name` is the value used in `HanaDB.spec.version`. +- `spec.version` is the HanaDB engine version. +- `spec.db.image` points to the image used for database pods. +- `spec.deprecated` marks versions that are not recommended for new use. + +## Next Steps + +- Read the [HanaDB CRD concept](/docs/guides/hanadb/concepts/hanadb.md). +- Run the [HanaDB quickstart](/docs/guides/hanadb/quickstart/quickstart.md). \ No newline at end of file diff --git a/docs/guides/hanadb/concepts/hanadb.md b/docs/guides/hanadb/concepts/hanadb.md new file mode 100644 index 000000000..d6e4eb4d2 --- /dev/null +++ b/docs/guides/hanadb/concepts/hanadb.md @@ -0,0 +1,54 @@ +--- +title: HanaDB CRD +menu: + docs_{{ .version }}: + identifier: hanadb-concepts-hanadb + name: HanaDB + parent: hanadb-concepts + weight: 10 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# HanaDB + +## What is HanaDB + +`HanaDB` is a Kubernetes `CustomResourceDefinition` (CRD) in KubeDB to run SAP HANA databases in a Kubernetes-native way. + +## HanaDB Spec + +```yaml +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: hana-cluster + namespace: demo +spec: + version: "2.0.82" + replicas: 2 + storageType: "Durable" + topology: + mode: SystemReplication + systemReplication: + replicationMode: fullsync + operationMode: logreplay_readaccess + storage: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 64Gi + storageClassName: local-path +``` + +### Key fields + +- `spec.version` refers to a `HanaDBVersion`. +- `spec.replicas` controls number of database instances. +- `spec.topology.mode` supports `Standalone` and `SystemReplication`. +- `spec.topology.systemReplication` configures replication and operation mode. +- `spec.storageType` and `spec.storage` define persistent data configuration. +- `spec.authSecret`, `spec.configuration`, `spec.podTemplate`, and `spec.monitor` are optional tuning controls. +- `spec.deletionPolicy` controls cleanup behavior. \ No newline at end of file diff --git a/docs/guides/hanadb/concepts/opsrequest.md b/docs/guides/hanadb/concepts/opsrequest.md new file mode 100644 index 000000000..d528bc170 --- /dev/null +++ b/docs/guides/hanadb/concepts/opsrequest.md @@ -0,0 +1,42 @@ +--- +title: HanaDBOpsRequest CRD +menu: + docs_{{ .version }}: + identifier: hanadb-opsrequest-concepts + name: HanaDBOpsRequest + parent: hanadb-concepts-hanadb + weight: 25 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# HanaDBOpsRequest + +## What is HanaDBOpsRequest + +`HanaDBOpsRequest` is the operations CRD KubeDB uses for day-2 lifecycle changes of HanaDB databases when supported in a release. + +## Current support status + +Based on [new_db.md](/new_db.md), no HanaDB operation types are currently listed. + +## Expected CRD shape + +```yaml +apiVersion: ops.kubedb.com/v1alpha1 +kind: HanaDBOpsRequest +metadata: + name: hanadb-ops-sample + namespace: demo +spec: + type: Restart + databaseRef: + name: hana-cluster +``` + +## Next Steps + +- Track [HanaDB ops overview](/docs/guides/hanadb/ops-request/overview.md) for support updates. +- Use [HanaDB monitoring guide](/docs/guides/hanadb/monitoring/overview.md) for day-2 operational readiness. \ No newline at end of file diff --git a/docs/guides/hanadb/configuration/_index.md b/docs/guides/hanadb/configuration/_index.md new file mode 100644 index 000000000..efe02bcd6 --- /dev/null +++ b/docs/guides/hanadb/configuration/_index.md @@ -0,0 +1,10 @@ +--- +title: Run HanaDB with Custom Configuration +menu: + docs_{{ .version }}: + identifier: hanadb-configuration + name: Custom Configuration + parent: hanadb-guides + weight: 130 +menu_name: docs_{{ .version }} +--- diff --git a/docs/guides/hanadb/configuration/using-config-file.md b/docs/guides/hanadb/configuration/using-config-file.md new file mode 100644 index 000000000..a364b7a7e --- /dev/null +++ b/docs/guides/hanadb/configuration/using-config-file.md @@ -0,0 +1,144 @@ +--- +title: Run HanaDB with Custom Configuration +menu: + docs_{{ .version }}: + identifier: hanadb-using-config-file + name: Config File + parent: hanadb-configuration + weight: 10 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# Using Custom Configuration File + +KubeDB supports providing custom configuration for HanaDB. This tutorial will show you how to use KubeDB to run HanaDB with custom configuration. + +## Before You Begin + +- At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). + +- Now, install KubeDB cli on your workstation and KubeDB operator in your cluster following the steps [here](/docs/setup/README.md). + +- To keep things isolated, this tutorial uses a separate namespace called `demo` throughout this tutorial. + +```bash +$ kubectl create ns demo +namespace/demo created +``` + +> Note: YAML files used in this tutorial are stored in [docs/examples/hanadb](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/hanadb) folder in GitHub repository [kubedb/docs](https://github.com/kubedb/docs). + +## Overview + +SAP HANA allows configuration via the `global.ini` and `indexserver.ini` configuration files. KubeDB takes advantage of the `spec.configuration.secretName` field to allow users to provide their custom configuration without mounting any volume into the Pod. + +To apply custom configuration, you create a Kubernetes Secret containing your custom config file and provide its name in `spec.configuration.secretName`. The operator reads this Secret internally and applies the configuration automatically. + +In this tutorial, we will configure `indexserver.ini` with a custom `max_memory` parameter. + +## Custom Configuration + +At first, let's create a custom `global.ini` file: + +```ini +[system] +usage = development + +[memorymanager] +alloclimit = 16384 +``` + +Now, create a Secret with this configuration file. + +```bash +$ kubectl create secret generic -n demo hanadb-configuration \ + --from-file=global.ini=./global.ini +secret/hanadb-configuration created +``` + +Verify the Secret has the configuration file. + +```yaml +$ kubectl get secret -n demo hanadb-configuration -o yaml +apiVersion: v1 +data: + global.ini: +kind: Secret +metadata: + name: hanadb-configuration + namespace: demo +``` + +Now, create HanaDB CRD specifying `spec.configuration.secretName` field. + +```yaml +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: custom-hanadb + namespace: demo +spec: + version: "2.0" + replicas: 1 + configuration: + secretName: hanadb-configuration + storageType: Durable + storage: + storageClassName: "standard" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + deletionPolicy: WipeOut +``` + +```bash +$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/configuration/hanadb-configuration.yaml +hanadb.kubedb.com/custom-hanadb created +``` + +Now, wait for the HanaDB to be ready. + +```bash +$ kubectl get hanadb -n demo custom-hanadb +NAME VERSION STATUS AGE +custom-hanadb 2.0 Ready 5m +``` + +Check that the pod is running: + +```bash +$ kubectl get pod -n demo custom-hanadb-0 +NAME READY STATUS RESTARTS AGE +custom-hanadb-0 1/1 Running 0 5m +``` + +Now, we will check if the database has started with the custom configuration we have provided. We will `exec` into the pod and use the HDB CLI to check the configuration. + +```bash +$ kubectl exec -it -n demo custom-hanadb-0 -- hdbsql \ + -u SYSTEM -p \ + "SELECT KEY, VALUE FROM SYS.M_INIFILE_CONTENTS WHERE FILE_NAME = 'global.ini' AND KEY = 'alloclimit'" +KEY VALUE +alloclimit 16384 +``` + +## Reconfiguring + +If you want to change the configuration, you can update the Secret and then trigger a reconfigure OpsRequest. For more details, see the [Reconfigure](/docs/guides/hanadb/ops-request/overview.md) section. + +## Cleaning up + +To cleanup the Kubernetes resources created by this tutorial, run: + +```bash +kubectl patch -n demo hanadb/custom-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" +kubectl delete -n demo hanadb/custom-hanadb + +kubectl delete -n demo secret hanadb-configuration +kubectl delete ns demo +``` diff --git a/docs/guides/hanadb/custom-rbac/_index.md b/docs/guides/hanadb/custom-rbac/_index.md new file mode 100644 index 000000000..4304ca94f --- /dev/null +++ b/docs/guides/hanadb/custom-rbac/_index.md @@ -0,0 +1,10 @@ +--- +title: Run HanaDB with Custom RBAC resources +menu: + docs_{{ .version }}: + identifier: hanadb-custom-rbac + name: Custom RBAC + parent: hanadb-guides + weight: 90 +menu_name: docs_{{ .version }} +--- diff --git a/docs/guides/hanadb/custom-rbac/using-custom-rbac.md b/docs/guides/hanadb/custom-rbac/using-custom-rbac.md new file mode 100644 index 000000000..a1df6e7f6 --- /dev/null +++ b/docs/guides/hanadb/custom-rbac/using-custom-rbac.md @@ -0,0 +1,160 @@ +--- +title: Run HanaDB with Custom RBAC resources +menu: + docs_{{ .version }}: + identifier: hanadb-custom-rbac-quickstart + name: Custom RBAC + parent: hanadb-custom-rbac + weight: 10 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# Using Custom RBAC Resources + +KubeDB supports finer user control over role based access permissions provided to a HanaDB instance. This tutorial will show you how to use KubeDB to run HanaDB instance with custom RBAC resources. + +## Before You Begin + +At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). + +Now, install KubeDB cli on your workstation and KubeDB operator in your cluster following the steps [here](/docs/setup/README.md). + +To keep things isolated, this tutorial uses a separate namespace called `demo` throughout this tutorial. + +```bash +$ kubectl create ns demo +namespace/demo created +``` + +## Overview + +KubeDB allows users to provide custom RBAC resources, namely, `ServiceAccount`, `Role`, and `RoleBinding` for HanaDB. This is provided via the `spec.podTemplate.spec.serviceAccountName` field in HanaDB CRD. If this field is left empty, the KubeDB operator will create a service account name matching the HanaDB CRD name. + +If a service account name is given with an existing service account, the KubeDB operator will use that existing service account. Users are responsible for providing necessary access permissions manually. + +## Custom RBAC for HanaDB + +At first, let's create a `Service Account` in `demo` namespace. + +```bash +$ kubectl create serviceaccount -n demo my-custom-serviceaccount +serviceaccount/my-custom-serviceaccount created +``` + +Now, we need to create a role that has necessary access permissions for the HanaDB database named `quick-hanadb`. + +```yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: my-custom-role + namespace: demo +rules: +- apiGroups: + - apps + resourceNames: + - quick-hanadb + resources: + - petsets + verbs: + - get +- apiGroups: + - kubedb.com + resourceNames: + - quick-hanadb + resources: + - hanadbs + verbs: + - get +- apiGroups: + - "" + resources: + - pods + verbs: + - list + - patch +- apiGroups: + - "" + resources: + - pods/exec + verbs: + - create +- apiGroups: + - "" + resources: + - configmaps + verbs: + - create + - get + - update +``` + +```bash +$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/custom-rbac/hanadb-custom-role.yaml +role.rbac.authorization.k8s.io/my-custom-role created +``` + +Now create a `RoleBinding` to bind this `Role` with the already created service account. + +```bash +$ kubectl create rolebinding my-custom-rolebinding \ + --role=my-custom-role \ + --serviceaccount=demo:my-custom-serviceaccount \ + --namespace=demo +rolebinding.rbac.authorization.k8s.io/my-custom-rolebinding created +``` + +Now, create a HanaDB CRD specifying `spec.podTemplate.spec.serviceAccountName` field to `my-custom-serviceaccount`. + +```yaml +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: quick-hanadb + namespace: demo +spec: + version: "2.0" + replicas: 1 + storageType: Durable + podTemplate: + spec: + serviceAccountName: my-custom-serviceaccount + storage: + storageClassName: "standard" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + deletionPolicy: WipeOut +``` + +```bash +$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/custom-rbac/hanadb-custom-db.yaml +hanadb.kubedb.com/quick-hanadb created +``` + +Check that the pod is running: + +```bash +$ kubectl get pod -n demo quick-hanadb-0 +NAME READY STATUS RESTARTS AGE +quick-hanadb-0 1/1 Running 0 5m +``` + +## Cleaning up + +To cleanup the Kubernetes resources created by this tutorial, run: + +```bash +kubectl patch -n demo hanadb/quick-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" +kubectl delete -n demo hanadb/quick-hanadb + +kubectl delete -n demo serviceaccount my-custom-serviceaccount +kubectl delete -n demo role my-custom-role +kubectl delete -n demo rolebinding my-custom-rolebinding +kubectl delete ns demo +``` diff --git a/docs/guides/hanadb/monitoring/_index.md b/docs/guides/hanadb/monitoring/_index.md new file mode 100644 index 000000000..e7f7b1a87 --- /dev/null +++ b/docs/guides/hanadb/monitoring/_index.md @@ -0,0 +1,10 @@ +--- +title: HanaDB Monitoring +menu: + docs_{{ .version }}: + identifier: hanadb-monitoring + name: Monitoring + parent: hanadb-guides + weight: 20 +menu_name: docs_{{ .version }} +--- diff --git a/docs/guides/hanadb/monitoring/overview.md b/docs/guides/hanadb/monitoring/overview.md new file mode 100644 index 000000000..d94268b3f --- /dev/null +++ b/docs/guides/hanadb/monitoring/overview.md @@ -0,0 +1,39 @@ +--- +title: HanaDB Monitoring Overview +menu: + docs_{{ .version }}: + identifier: hanadb-monitoring-overview + name: Overview + parent: hanadb-monitoring + weight: 10 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +# HanaDB Monitoring + +This guide shows how to enable and verify monitoring for HanaDB. + +## Before You Begin + +- Deploy HanaDB first using the [quickstart guide](/docs/guides/hanadb/quickstart/quickstart.md). +- Install Prometheus Operator or another monitoring stack that can scrape Kubernetes targets. + +## Enable Monitoring + +HanaDB monitoring is configured via `spec.monitor`. + +- Use Prometheus operator-based scraping where available. +- Ensure metrics endpoints are reachable from the monitoring namespace. + +## Verify + +```bash +kubectl get hanadb -n demo hana-cluster -o yaml +kubectl get servicemonitor -A +``` + +## Next Steps + +- Add alerts for pod health, storage usage, and replication status. +- Review your Prometheus targets after every database topology change. diff --git a/docs/guides/hanadb/monitoring/using-builtin-prometheus.md b/docs/guides/hanadb/monitoring/using-builtin-prometheus.md new file mode 100644 index 000000000..02494babb --- /dev/null +++ b/docs/guides/hanadb/monitoring/using-builtin-prometheus.md @@ -0,0 +1,177 @@ +--- +title: Monitor HanaDB using Builtin Prometheus Discovery +menu: + docs_{{ .version }}: + identifier: hanadb-using-builtin-prometheus-monitoring + name: Builtin Prometheus + parent: hanadb-monitoring + weight: 20 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# Monitoring HanaDB with Builtin Prometheus + +This tutorial will show you how to monitor HanaDB database using builtin [Prometheus](https://github.com/prometheus/prometheus) scraper. + +## Before You Begin + +- At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). + +- Install KubeDB operator in your cluster following the steps [here](/docs/setup/README.md). + +- If you are not familiar with how to configure Prometheus to scrape metrics from various Kubernetes resources, please read the tutorial from [here](https://github.com/appscode/third-party-tools/tree/master/monitoring/prometheus/builtin). + +- To learn how Prometheus monitoring works with KubeDB in general, please visit [here](/docs/guides/hanadb/monitoring/overview.md). + +- To keep Prometheus resources isolated, we are going to use a separate namespace called `monitoring` to deploy respective monitoring resources. We are going to deploy the database in `demo` namespace. + + ```bash + $ kubectl create ns monitoring + namespace/monitoring created + + $ kubectl create ns demo + namespace/demo created + ``` + +> Note: YAML files used in this tutorial are stored in [docs/examples/hanadb](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/hanadb) folder in GitHub repository [kubedb/docs](https://github.com/kubedb/docs). + +## Deploy HanaDB with Monitoring Enabled + +At first, let's deploy a HanaDB database with monitoring enabled. Below is the HanaDB object that we are going to create. + +```yaml +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: builtin-prom-hanadb + namespace: demo +spec: + version: "2.0" + replicas: 1 + storageType: Durable + storage: + storageClassName: "standard" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + deletionPolicy: WipeOut + monitor: + agent: prometheus.io/builtin +``` + +Here, `spec.monitor.agent: prometheus.io/builtin` specifies that we are going to monitor this server using builtin Prometheus scraper. + +Let's create the HanaDB CR we have shown above. + +```bash +$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/monitoring/builtin-prom-hanadb.yaml +hanadb.kubedb.com/builtin-prom-hanadb created +``` + +Now, wait for the database to go into `Ready` state. + +```bash +$ kubectl get hanadb -n demo builtin-prom-hanadb +NAME VERSION STATUS AGE +builtin-prom-hanadb 2.0 Ready 2m +``` + +KubeDB will create a separate stats service with name `{HanaDB crd name}-stats` for monitoring purpose. + +```bash +$ kubectl get svc -n demo --selector="app.kubernetes.io/instance=builtin-prom-hanadb" +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +builtin-prom-hanadb ClusterIP 10.96.100.10 39017/TCP 2m +builtin-prom-hanadb-stats ClusterIP 10.96.100.11 56790/TCP 90s +``` + +Here, `builtin-prom-hanadb-stats` service has been created for monitoring purpose. Let's describe the service. + +```bash +$ kubectl describe svc -n demo builtin-prom-hanadb-stats +Name: builtin-prom-hanadb-stats +Namespace: demo +Labels: app.kubernetes.io/name=hanadbs.kubedb.com + app.kubernetes.io/instance=builtin-prom-hanadb +Annotations: monitoring.appscode.com/agent: prometheus.io/builtin + prometheus.io/path: /metrics + prometheus.io/port: 56790 + prometheus.io/scrape: true +Selector: app.kubernetes.io/name=hanadbs.kubedb.com,app.kubernetes.io/instance=builtin-prom-hanadb +Type: ClusterIP +Port: prom-http 56790/TCP +``` + +You can see that the service contains the following annotations, which are used by builtin Prometheus to discover the endpoint: + +``` +prometheus.io/path: /metrics +prometheus.io/port: 56790 +prometheus.io/scrape: true +``` + +## Configure Prometheus + +Now we need to configure Prometheus to scrape metrics from this service. Add the following `scrape_config` to your Prometheus configuration: + +```yaml +scrape_configs: +- job_name: kubedb-hanadbs + honor_labels: true + kubernetes_sd_configs: + - role: endpoints + relabel_configs: + - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape] + separator: ; + regex: true + target_label: __tmp_prometheus_service_scrape + replacement: $1 + action: keep + - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme] + separator: ; + regex: (https?) + target_label: __scheme__ + replacement: $1 + action: replace + - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path] + separator: ; + regex: (.+) + target_label: __metrics_path__ + replacement: $1 + action: replace + - source_labels: [__address__, __meta_kubernetes_service_annotation_prometheus_io_port] + separator: ; + regex: ([^:]+)(?::\d+)?;(\d+) + target_label: __address__ + replacement: $1:$2 + action: replace +``` + +Now Prometheus will discover the HanaDB stats service and scrape metrics automatically. + +## Access Prometheus Dashboard + +To access the Prometheus dashboard, port-forward the Prometheus service and visit `http://localhost:9090` in your browser. + +```bash +$ kubectl port-forward -n monitoring svc/prometheus 9090:9090 +``` + +You should see the HanaDB metrics in the Prometheus dashboard under the `kubedb-hanadbs` job. + +## Cleaning up + +To cleanup the Kubernetes resources created by this tutorial, run: + +```bash +kubectl patch -n demo hanadb/builtin-prom-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" +kubectl delete -n demo hanadb/builtin-prom-hanadb + +kubectl delete ns demo +kubectl delete ns monitoring +``` diff --git a/docs/guides/hanadb/monitoring/using-prometheus-operator.md b/docs/guides/hanadb/monitoring/using-prometheus-operator.md new file mode 100644 index 000000000..e4cdd2248 --- /dev/null +++ b/docs/guides/hanadb/monitoring/using-prometheus-operator.md @@ -0,0 +1,153 @@ +--- +title: Monitor HanaDB using Prometheus Operator +menu: + docs_{{ .version }}: + identifier: hanadb-using-prometheus-operator-monitoring + name: Prometheus Operator + parent: hanadb-monitoring + weight: 30 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# Monitoring HanaDB with Prometheus Operator + +This tutorial will show you how to monitor HanaDB database using [Prometheus Operator](https://github.com/prometheus-operator/prometheus-operator). + +## Before You Begin + +- At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). + +- Install KubeDB operator in your cluster following the steps [here](/docs/setup/README.md). + +- Install Prometheus Operator in your cluster following the steps from [here](https://github.com/appscode/third-party-tools/tree/master/monitoring/prometheus/coreos-operator). If you want to use an already deployed Prometheus instance, configure it to monitor all namespaces. + +- To learn how Prometheus monitoring works with KubeDB in general, please visit [here](/docs/guides/hanadb/monitoring/overview.md). + +- To keep Prometheus resources isolated, we are going to use a separate namespace called `monitoring` to deploy respective monitoring resources. We are going to deploy the database in `demo` namespace. + + ```bash + $ kubectl create ns monitoring + namespace/monitoring created + + $ kubectl create ns demo + namespace/demo created + ``` + +> Note: YAML files used in this tutorial are stored in [docs/examples/hanadb](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/hanadb) folder in GitHub repository [kubedb/docs](https://github.com/kubedb/docs). + +## Deploy HanaDB with Monitoring Enabled + +At first, let's deploy a HanaDB database with monitoring enabled using the Prometheus Operator. + +```yaml +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: coreos-prom-hanadb + namespace: demo +spec: + version: "2.0" + replicas: 1 + storageType: Durable + storage: + storageClassName: "standard" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + deletionPolicy: WipeOut + monitor: + agent: prometheus.io/operator + prometheus: + serviceMonitor: + labels: + release: prometheus + interval: 10s +``` + +Here, + +- `spec.monitor.agent: prometheus.io/operator` tells KubeDB that we want to monitor using Prometheus Operator. +- `spec.monitor.prometheus.serviceMonitor.labels` specifies labels to add to the ServiceMonitor. The Prometheus CR must have matching labels in its `serviceMonitorSelector`. +- `spec.monitor.prometheus.serviceMonitor.interval` specifies the scrape interval. + +Let's create the HanaDB CR: + +```bash +$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/monitoring/coreos-prom-hanadb.yaml +hanadb.kubedb.com/coreos-prom-hanadb created +``` + +Now, wait for the database to go into `Ready` state. + +```bash +$ kubectl get hanadb -n demo coreos-prom-hanadb +NAME VERSION STATUS AGE +coreos-prom-hanadb 2.0 Ready 2m +``` + +KubeDB will create a ServiceMonitor and stats service for this HanaDB instance. + +```bash +$ kubectl get servicemonitor -n demo +NAME AGE +coreos-prom-hanadb-stats 2m +``` + +Let's verify the ServiceMonitor: + +```yaml +$ kubectl get servicemonitor -n demo coreos-prom-hanadb-stats -o yaml +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + labels: + app.kubernetes.io/component: database + app.kubernetes.io/instance: coreos-prom-hanadb + app.kubernetes.io/managed-by: kubedb.com + app.kubernetes.io/name: hanadbs.kubedb.com + release: prometheus + name: coreos-prom-hanadb-stats + namespace: demo +spec: + endpoints: + - honorLabels: true + interval: 10s + path: /metrics + port: prom-http + namespaceSelector: + matchNames: + - demo + selector: + matchLabels: + app.kubernetes.io/instance: coreos-prom-hanadb + app.kubernetes.io/name: hanadbs.kubedb.com +``` + +Prometheus Operator will automatically pick up this ServiceMonitor and start scraping metrics from the HanaDB stats service. + +## Access Prometheus Dashboard + +To verify, port-forward the Prometheus service and visit `http://localhost:9090/targets`: + +```bash +$ kubectl port-forward -n monitoring svc/prometheus-kube-prometheus-prometheus 9090:9090 +``` + +You should see `demo/coreos-prom-hanadb-stats` target in an UP state. + +## Cleaning up + +To cleanup the Kubernetes resources created by this tutorial, run: + +```bash +kubectl patch -n demo hanadb/coreos-prom-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" +kubectl delete -n demo hanadb/coreos-prom-hanadb + +kubectl delete ns demo +kubectl delete ns monitoring +``` diff --git a/docs/guides/hanadb/ops-request/_index.md b/docs/guides/hanadb/ops-request/_index.md new file mode 100644 index 000000000..e95ee8530 --- /dev/null +++ b/docs/guides/hanadb/ops-request/_index.md @@ -0,0 +1,10 @@ +--- +title: Ops Request +menu: + docs_{{ .version }}: + identifier: hanadb-ops-request + name: Ops Request + parent: hanadb-guides + weight: 30 +menu_name: docs_{{ .version }} +--- diff --git a/docs/guides/hanadb/ops-request/overview.md b/docs/guides/hanadb/ops-request/overview.md new file mode 100644 index 000000000..669d016df --- /dev/null +++ b/docs/guides/hanadb/ops-request/overview.md @@ -0,0 +1,29 @@ +--- +title: HanaDB Ops Request Overview +menu: + docs_{{ .version }}: + identifier: hanadb-ops-request-overview + name: Overview + parent: hanadb-ops-request + weight: 10 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +# HanaDB Ops Request + +This page tracks HanaDB operations supported by the new database matrix used for these guides. + +## Before You Begin + +- Deploy HanaDB first using the [quickstart guide](/docs/guides/hanadb/quickstart/quickstart.md). +- Confirm the current support list in [new_db.md](/new_db.md) for your release. + +## Current Status + +Based on [new_db.md](/new_db.md), no HanaDB ops request types are listed yet. + +## What to Check Next + +- Watch future KubeDB releases for HanaDB `OpsRequest` support. +- Use the monitoring and quickstart guides to validate regular day-2 operations until explicit ops support is added. diff --git a/docs/guides/hanadb/private-registry/_index.md b/docs/guides/hanadb/private-registry/_index.md new file mode 100644 index 000000000..219abddd1 --- /dev/null +++ b/docs/guides/hanadb/private-registry/_index.md @@ -0,0 +1,10 @@ +--- +title: Run HanaDB using Private Registry +menu: + docs_{{ .version }}: + identifier: hanadb-private-registry + name: Private Registry + parent: hanadb-guides + weight: 120 +menu_name: docs_{{ .version }} +--- diff --git a/docs/guides/hanadb/private-registry/using-private-registry.md b/docs/guides/hanadb/private-registry/using-private-registry.md new file mode 100644 index 000000000..c5db030cf --- /dev/null +++ b/docs/guides/hanadb/private-registry/using-private-registry.md @@ -0,0 +1,127 @@ +--- +title: Run HanaDB using Private Registry +menu: + docs_{{ .version }}: + identifier: hanadb-using-private-registry + name: Quickstart + parent: hanadb-private-registry + weight: 10 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# Using Private Docker Registry + +KubeDB supports using private Docker registries. This tutorial will show you how to run KubeDB managed HanaDB database using private Docker images. + +## Before You Begin + +At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). + +To keep things isolated, this tutorial uses a separate namespace called `demo` throughout this tutorial. + +```bash +$ kubectl create ns demo +namespace/demo created +``` + +## Prepare Private Docker Registry + +- You will also need a docker private [registry](https://docs.docker.com/registry/) or [private repository](https://docs.docker.com/docker-hub/repos/#private-repositories). + +- Push the required images from KubeDB's [Docker hub account](https://hub.docker.com/r/kubedb/) into your private registry. For HanaDB, push the `DB_IMAGE` of the following HanaDBVersions, where `deprecated` is not true, to your private registry. + + ```bash + $ kubectl get hanadbversions -o=custom-columns=NAME:.metadata.name,VERSION:.spec.version,DB_IMAGE:.spec.db.image,DEPRECATED:.spec.deprecated + NAME VERSION DB_IMAGE DEPRECATED + 2.0 2.0 kubedb/hanadb:2.0 + ``` + +## Create ImagePullSecret + +Run the following command to create an image pull secret for your private Docker registry: + +```bash +$ kubectl create secret docker-registry -n demo myregistrykey \ + --docker-server=DOCKER_REGISTRY_SERVER \ + --docker-username=DOCKER_USER \ + --docker-email=DOCKER_EMAIL \ + --docker-password=DOCKER_PASSWORD +secret/myregistrykey created +``` + +## Install KubeDB Operator + +Follow the steps to [install KubeDB operator](/docs/setup/README.md) properly in cluster so that it points to the DOCKER_REGISTRY you wish to pull images from. + +## Create HanaDBVersion CRD + +Create a HanaDBVersion CRD specifying images from your private registry. Replace `PRIVATE_REGISTRY` with your private registry. + +```yaml +apiVersion: catalog.kubedb.com/v1alpha1 +kind: HanaDBVersion +metadata: + name: "2.0" +spec: + db: + image: PRIVATE_REGISTRY/hanadb:2.0 + version: "2.0" +``` + +```bash +$ kubectl apply -f pvt-hanadbversion.yaml +hanadbversion.catalog.kubedb.com/2.0 created +``` + +## Deploy HanaDB from Private Registry + +```yaml +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: pvt-reg-hanadb + namespace: demo +spec: + version: "2.0" + replicas: 1 + storageType: Durable + storage: + storageClassName: "standard" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + podTemplate: + spec: + imagePullSecrets: + - name: myregistrykey + deletionPolicy: WipeOut +``` + +```bash +$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/private-registry/pvt-reg-hanadb.yaml +hanadb.kubedb.com/pvt-reg-hanadb created +``` + +Check that the HanaDB is in Running state: + +```bash +$ kubectl get pods -n demo --selector="app.kubernetes.io/instance=pvt-reg-hanadb" +NAME READY STATUS RESTARTS AGE +pvt-reg-hanadb-0 1/1 Running 0 3m +``` + +## Cleaning up + +To cleanup the Kubernetes resources created by this tutorial, run: + +```bash +kubectl patch -n demo hanadb/pvt-reg-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" +kubectl delete -n demo hanadb/pvt-reg-hanadb + +kubectl delete ns demo +``` diff --git a/docs/guides/hanadb/quickstart/_index.md b/docs/guides/hanadb/quickstart/_index.md new file mode 100644 index 000000000..4b201d7d5 --- /dev/null +++ b/docs/guides/hanadb/quickstart/_index.md @@ -0,0 +1,10 @@ +--- +title: HanaDB Quickstart +menu: + docs_{{ .version }}: + identifier: hanadb-quickstart + name: Quickstart + parent: hanadb-guides + weight: 15 +menu_name: docs_{{ .version }} +--- \ No newline at end of file diff --git a/docs/guides/hanadb/quickstart/quickstart.md b/docs/guides/hanadb/quickstart/quickstart.md new file mode 100644 index 000000000..107c57a5f --- /dev/null +++ b/docs/guides/hanadb/quickstart/quickstart.md @@ -0,0 +1,88 @@ +--- +title: HanaDB Quickstart +menu: + docs_{{ .version }}: + identifier: hanadb-quickstart-overview + name: Overview + parent: hanadb-quickstart + weight: 10 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# Running HanaDB + +This tutorial shows how to run a HanaDB database with KubeDB. + +> Note: YAML files used in this tutorial are stored in [docs/examples/hanadb/quickstart](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/hanadb/quickstart). + +## Before You Begin + +- Prepare a Kubernetes cluster and `kubectl`. +- Install KubeDB from [/docs/setup/README.md](/docs/setup/README.md). +- This tutorial uses `docs/examples/hanadb/quickstart/system-replication.yaml` as the working example manifest. +- Create namespace: + +```bash +kubectl create ns demo +``` + +## Check Available StorageClass + +```bash +kubectl get storageclass +``` + +## Check Available HanaDBVersion + +```bash +kubectl get hanadbversions +``` + +## Create a HanaDB Database + +```yaml +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: hana-cluster + namespace: demo +spec: + version: "2.0.82" + replicas: 2 + storageType: "Durable" + topology: + mode: SystemReplication + systemReplication: + replicationMode: fullsync + operationMode: logreplay_readaccess + storage: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 64Gi + storageClassName: local-path +``` + +```bash +kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/quickstart/system-replication.yaml +kubectl get hanadb -n demo hana-cluster -w +``` + +## Verify HanaDB Database + +```bash +kubectl get hanadb -n demo +kubectl describe hanadb -n demo hana-cluster +``` + +When `status.phase` becomes `Ready`, the HanaDB deployment is ready for application traffic. + +## Cleaning up + +```bash +kubectl delete hanadb -n demo hana-cluster +kubectl delete ns demo +``` \ No newline at end of file diff --git a/docs/guides/hanadb/quickstart/rbac.md b/docs/guides/hanadb/quickstart/rbac.md new file mode 100644 index 000000000..126263000 --- /dev/null +++ b/docs/guides/hanadb/quickstart/rbac.md @@ -0,0 +1,179 @@ +--- +title: RBAC for HanaDB +menu: + docs_{{ .version }}: + identifier: hanadb-rbac-quickstart + name: RBAC + parent: hanadb-quickstart + weight: 15 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# RBAC Permissions for HanaDB + +When RBAC is enabled in your cluster, KubeDB automatically creates the necessary Role, ServiceAccount, and RoleBinding for each HanaDB instance. This tutorial explains what permissions are granted and how to verify them. + +Here is the list of additional permissions required by the PetSet of HanaDB: + +| Kubernetes Resource | Resource Names | Permission required | +|---------------------|-------------------|---------------------| +| petsets | `{hanadb-name}` | get | +| pods | | list, patch | +| pods/exec | | create | +| hanadbs | | get | +| configmaps | `{hanadb-name}` | get, update, create | + +## Before You Begin + +- At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). + +- Now, install KubeDB cli on your workstation and KubeDB operator in your cluster following the steps [here](/docs/setup/README.md). + +- To keep things isolated, this tutorial uses a separate namespace called `demo` throughout this tutorial. + +```bash +$ kubectl create ns demo +namespace/demo created +``` + +## Create a HanaDB Database + +Below is the HanaDB object created in this tutorial. + +```yaml +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: quick-hanadb + namespace: demo +spec: + version: "2.0" + replicas: 1 + storageType: Durable + storage: + storageClassName: "standard" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + deletionPolicy: Delete +``` + +Create the above HanaDB object: + +```bash +$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/quickstart/quick-hanadb.yaml +hanadb.kubedb.com/quick-hanadb created +``` + +When this HanaDB object is created, KubeDB operator creates Role, ServiceAccount and RoleBinding with the matching HanaDB name. + +### Role + +```bash +$ kubectl get role -n demo quick-hanadb -o yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + labels: + app.kubernetes.io/component: database + app.kubernetes.io/instance: quick-hanadb + app.kubernetes.io/managed-by: kubedb.com + app.kubernetes.io/name: hanadbs.kubedb.com + name: quick-hanadb + namespace: demo +rules: +- apiGroups: + - apps + resourceNames: + - quick-hanadb + resources: + - petsets + verbs: + - get +- apiGroups: + - kubedb.com + resourceNames: + - quick-hanadb + resources: + - hanadbs + verbs: + - get +- apiGroups: + - "" + resources: + - pods + verbs: + - get + - list + - patch +- apiGroups: + - "" + resources: + - pods/exec + verbs: + - create +- apiGroups: + - "" + resources: + - configmaps + verbs: + - create + - get + - update +``` + +### ServiceAccount + +```bash +$ kubectl get serviceaccount -n demo quick-hanadb -o yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app.kubernetes.io/component: database + app.kubernetes.io/instance: quick-hanadb + app.kubernetes.io/managed-by: kubedb.com + app.kubernetes.io/name: hanadbs.kubedb.com + name: quick-hanadb + namespace: demo +``` + +### RoleBinding + +```bash +$ kubectl get rolebinding -n demo quick-hanadb -o yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + app.kubernetes.io/component: database + app.kubernetes.io/instance: quick-hanadb + app.kubernetes.io/managed-by: kubedb.com + app.kubernetes.io/name: hanadbs.kubedb.com + name: quick-hanadb + namespace: demo +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: quick-hanadb +subjects: +- kind: ServiceAccount + name: quick-hanadb + namespace: demo +``` + +## Cleaning up + +To cleanup the Kubernetes resources created by this tutorial, run: + +```bash +kubectl patch -n demo hanadb/quick-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" +kubectl delete -n demo hanadb/quick-hanadb + +kubectl delete ns demo +``` From e55eaff08bb50a064f3d9a5e15fead1f875a0969 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Fri, 1 May 2026 20:00:27 +0600 Subject: [PATCH 2/5] docs(hanadb): use latest active catalog version in examples Signed-off-by: Tamal Saha Signed-off-by: ZobayerAbedin --- docs/guides/hanadb/configuration/using-config-file.md | 2 +- docs/guides/hanadb/custom-rbac/using-custom-rbac.md | 2 +- docs/guides/hanadb/monitoring/using-builtin-prometheus.md | 2 +- docs/guides/hanadb/monitoring/using-prometheus-operator.md | 2 +- docs/guides/hanadb/private-registry/using-private-registry.md | 4 ++-- docs/guides/hanadb/quickstart/rbac.md | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/guides/hanadb/configuration/using-config-file.md b/docs/guides/hanadb/configuration/using-config-file.md index a364b7a7e..8bfdff030 100644 --- a/docs/guides/hanadb/configuration/using-config-file.md +++ b/docs/guides/hanadb/configuration/using-config-file.md @@ -81,7 +81,7 @@ metadata: name: custom-hanadb namespace: demo spec: - version: "2.0" + version: "2.0.82" replicas: 1 configuration: secretName: hanadb-configuration diff --git a/docs/guides/hanadb/custom-rbac/using-custom-rbac.md b/docs/guides/hanadb/custom-rbac/using-custom-rbac.md index a1df6e7f6..dc4a58a7d 100644 --- a/docs/guides/hanadb/custom-rbac/using-custom-rbac.md +++ b/docs/guides/hanadb/custom-rbac/using-custom-rbac.md @@ -116,7 +116,7 @@ metadata: name: quick-hanadb namespace: demo spec: - version: "2.0" + version: "2.0.82" replicas: 1 storageType: Durable podTemplate: diff --git a/docs/guides/hanadb/monitoring/using-builtin-prometheus.md b/docs/guides/hanadb/monitoring/using-builtin-prometheus.md index 02494babb..d610f2e49 100644 --- a/docs/guides/hanadb/monitoring/using-builtin-prometheus.md +++ b/docs/guides/hanadb/monitoring/using-builtin-prometheus.md @@ -49,7 +49,7 @@ metadata: name: builtin-prom-hanadb namespace: demo spec: - version: "2.0" + version: "2.0.82" replicas: 1 storageType: Durable storage: diff --git a/docs/guides/hanadb/monitoring/using-prometheus-operator.md b/docs/guides/hanadb/monitoring/using-prometheus-operator.md index e4cdd2248..051ae30ba 100644 --- a/docs/guides/hanadb/monitoring/using-prometheus-operator.md +++ b/docs/guides/hanadb/monitoring/using-prometheus-operator.md @@ -49,7 +49,7 @@ metadata: name: coreos-prom-hanadb namespace: demo spec: - version: "2.0" + version: "2.0.82" replicas: 1 storageType: Durable storage: diff --git a/docs/guides/hanadb/private-registry/using-private-registry.md b/docs/guides/hanadb/private-registry/using-private-registry.md index c5db030cf..3de2ca4f1 100644 --- a/docs/guides/hanadb/private-registry/using-private-registry.md +++ b/docs/guides/hanadb/private-registry/using-private-registry.md @@ -68,7 +68,7 @@ metadata: spec: db: image: PRIVATE_REGISTRY/hanadb:2.0 - version: "2.0" + version: "2.0.82" ``` ```bash @@ -85,7 +85,7 @@ metadata: name: pvt-reg-hanadb namespace: demo spec: - version: "2.0" + version: "2.0.82" replicas: 1 storageType: Durable storage: diff --git a/docs/guides/hanadb/quickstart/rbac.md b/docs/guides/hanadb/quickstart/rbac.md index 126263000..18a3d2a3e 100644 --- a/docs/guides/hanadb/quickstart/rbac.md +++ b/docs/guides/hanadb/quickstart/rbac.md @@ -50,7 +50,7 @@ metadata: name: quick-hanadb namespace: demo spec: - version: "2.0" + version: "2.0.82" replicas: 1 storageType: Durable storage: From d724fe4a659607f8c8a188bd498e35a84e06c308 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Fri, 1 May 2026 21:39:04 +0600 Subject: [PATCH 3/5] docs(hanadb): add required coordinator and exporter fields to HanaDBVersion examples Signed-off-by: Tamal Saha Signed-off-by: ZobayerAbedin --- docs/guides/hanadb/concepts/catalog.md | 8 +++++++- .../hanadb/private-registry/using-private-registry.md | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/guides/hanadb/concepts/catalog.md b/docs/guides/hanadb/concepts/catalog.md index ff59b1f07..969e05a0a 100644 --- a/docs/guides/hanadb/concepts/catalog.md +++ b/docs/guides/hanadb/concepts/catalog.md @@ -28,9 +28,13 @@ kind: HanaDBVersion metadata: name: "2.0.82" spec: - version: "2.0.82" + coordinator: + image: ghcr.io/kubedb/hanadb-coordinator:v0.4.0 db: image: "kubedb/hanadb:2.0.82" + exporter: + image: ghcr.io/kubedb/hanadb-exporter:1.0.0 + version: "2.0.82" deprecated: false ``` @@ -38,7 +42,9 @@ spec: - `metadata.name` is the value used in `HanaDB.spec.version`. - `spec.version` is the HanaDB engine version. +- `spec.coordinator.image` points to the coordinator sidecar image. - `spec.db.image` points to the image used for database pods. +- `spec.exporter.image` points to the metrics exporter image. - `spec.deprecated` marks versions that are not recommended for new use. ## Next Steps diff --git a/docs/guides/hanadb/private-registry/using-private-registry.md b/docs/guides/hanadb/private-registry/using-private-registry.md index 3de2ca4f1..80bff9852 100644 --- a/docs/guides/hanadb/private-registry/using-private-registry.md +++ b/docs/guides/hanadb/private-registry/using-private-registry.md @@ -66,8 +66,12 @@ kind: HanaDBVersion metadata: name: "2.0" spec: + coordinator: + image: PRIVATE_REGISTRY/hanadb-coordinator:v0.4.0 db: image: PRIVATE_REGISTRY/hanadb:2.0 + exporter: + image: PRIVATE_REGISTRY/hanadb-exporter:1.0.0 version: "2.0.82" ``` From 4c45e458a510a78caa9dbb3047c333caec9e0056 Mon Sep 17 00:00:00 2001 From: ZobayerAbedin Date: Tue, 5 May 2026 10:31:47 +0600 Subject: [PATCH 4/5] Add systemreplication and other fixes Signed-off-by: ZobayerAbedin --- .../hanadb/clustering/standalone.yaml | 17 ++ .../hanadb/clustering/system-replication.yaml | 22 ++ .../hanadb/configuration/custom-hanadb.yaml | 19 ++ .../configuration/hanadb-configuration.yaml | 9 + .../hanadb-custom-clusterrole.yaml | 21 ++ .../hanadb-custom-clusterrolebinding.yaml | 12 + .../hanadb/custom-rbac/hanadb-custom-db.yaml | 20 ++ .../custom-rbac/hanadb-custom-role.yaml | 58 +++++ .../monitoring/builtin-prom-hanadb.yaml | 22 ++ .../hanadb/monitoring/coreos-prom-hanadb.yaml | 26 ++ .../private-registry/pvt-hanadbversion.yaml | 18 ++ .../private-registry/pvt-reg-hanadb.yaml | 21 ++ .../hanadb/quickstart/quick-hanadb.yaml | 17 ++ .../hanadb/quickstart/system-replication.yaml | 2 +- docs/guides/hanadb/README.md | 32 ++- docs/guides/hanadb/clustering/_index.md | 10 + docs/guides/hanadb/clustering/standalone.md | 76 ++++++ .../hanadb/clustering/system-replication.md | 225 ++++++++++++++++++ docs/guides/hanadb/concepts/_index.md | 4 +- docs/guides/hanadb/concepts/appbinding.md | 67 ++++++ docs/guides/hanadb/concepts/catalog.md | 21 +- docs/guides/hanadb/concepts/hanadb.md | 12 +- docs/guides/hanadb/concepts/opsrequest.md | 42 ---- docs/guides/hanadb/configuration/_index.md | 2 +- .../hanadb/configuration/using-config-file.md | 61 +++-- docs/guides/hanadb/custom-rbac/_index.md | 4 +- .../hanadb/custom-rbac/using-custom-rbac.md | 118 +++++++-- docs/guides/hanadb/monitoring/_index.md | 2 +- docs/guides/hanadb/monitoring/overview.md | 59 ++++- .../monitoring/using-builtin-prometheus.md | 51 ++-- .../monitoring/using-prometheus-operator.md | 30 ++- docs/guides/hanadb/ops-request/_index.md | 10 - docs/guides/hanadb/ops-request/overview.md | 29 --- docs/guides/hanadb/private-registry/_index.md | 2 +- .../using-private-registry.md | 46 ++-- docs/guides/hanadb/quickstart/_index.md | 2 +- docs/guides/hanadb/quickstart/quickstart.md | 12 +- docs/guides/hanadb/quickstart/rbac.md | 128 +++++++--- 38 files changed, 1059 insertions(+), 270 deletions(-) create mode 100644 docs/examples/hanadb/clustering/standalone.yaml create mode 100644 docs/examples/hanadb/clustering/system-replication.yaml create mode 100644 docs/examples/hanadb/configuration/custom-hanadb.yaml create mode 100644 docs/examples/hanadb/configuration/hanadb-configuration.yaml create mode 100644 docs/examples/hanadb/custom-rbac/hanadb-custom-clusterrole.yaml create mode 100644 docs/examples/hanadb/custom-rbac/hanadb-custom-clusterrolebinding.yaml create mode 100644 docs/examples/hanadb/custom-rbac/hanadb-custom-db.yaml create mode 100644 docs/examples/hanadb/custom-rbac/hanadb-custom-role.yaml create mode 100644 docs/examples/hanadb/monitoring/builtin-prom-hanadb.yaml create mode 100644 docs/examples/hanadb/monitoring/coreos-prom-hanadb.yaml create mode 100644 docs/examples/hanadb/private-registry/pvt-hanadbversion.yaml create mode 100644 docs/examples/hanadb/private-registry/pvt-reg-hanadb.yaml create mode 100644 docs/examples/hanadb/quickstart/quick-hanadb.yaml create mode 100644 docs/guides/hanadb/clustering/_index.md create mode 100644 docs/guides/hanadb/clustering/standalone.md create mode 100644 docs/guides/hanadb/clustering/system-replication.md create mode 100644 docs/guides/hanadb/concepts/appbinding.md delete mode 100644 docs/guides/hanadb/concepts/opsrequest.md delete mode 100644 docs/guides/hanadb/ops-request/_index.md delete mode 100644 docs/guides/hanadb/ops-request/overview.md diff --git a/docs/examples/hanadb/clustering/standalone.yaml b/docs/examples/hanadb/clustering/standalone.yaml new file mode 100644 index 000000000..6654601c1 --- /dev/null +++ b/docs/examples/hanadb/clustering/standalone.yaml @@ -0,0 +1,17 @@ +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: hana-standalone + namespace: demo +spec: + version: "2.0.82" + replicas: 1 + storageType: Durable + storage: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 64Gi + storageClassName: local-path + deletionPolicy: WipeOut diff --git a/docs/examples/hanadb/clustering/system-replication.yaml b/docs/examples/hanadb/clustering/system-replication.yaml new file mode 100644 index 000000000..ad5f5c657 --- /dev/null +++ b/docs/examples/hanadb/clustering/system-replication.yaml @@ -0,0 +1,22 @@ +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: hana-cluster + namespace: demo +spec: + version: "2.0.82" + replicas: 3 + storageType: Durable + topology: + mode: SystemReplication + systemReplication: + replicationMode: fullsync + operationMode: logreplay_readaccess + storage: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 64Gi + storageClassName: local-path + deletionPolicy: WipeOut diff --git a/docs/examples/hanadb/configuration/custom-hanadb.yaml b/docs/examples/hanadb/configuration/custom-hanadb.yaml new file mode 100644 index 000000000..2bff92e4b --- /dev/null +++ b/docs/examples/hanadb/configuration/custom-hanadb.yaml @@ -0,0 +1,19 @@ +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: custom-hanadb + namespace: demo +spec: + version: "2.0.82" + replicas: 1 + configuration: + secretName: hanadb-configuration + storageType: Durable + storage: + storageClassName: local-path + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 64Gi + deletionPolicy: WipeOut diff --git a/docs/examples/hanadb/configuration/hanadb-configuration.yaml b/docs/examples/hanadb/configuration/hanadb-configuration.yaml new file mode 100644 index 000000000..477b4db4b --- /dev/null +++ b/docs/examples/hanadb/configuration/hanadb-configuration.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Secret +metadata: + name: hanadb-configuration + namespace: demo +stringData: + global.ini: | + [memorymanager] + global_allocation_limit = 8589934592 diff --git a/docs/examples/hanadb/custom-rbac/hanadb-custom-clusterrole.yaml b/docs/examples/hanadb/custom-rbac/hanadb-custom-clusterrole.yaml new file mode 100644 index 000000000..6b4244ff0 --- /dev/null +++ b/docs/examples/hanadb/custom-rbac/hanadb-custom-clusterrole.yaml @@ -0,0 +1,21 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: my-custom-clusterrole +rules: +- apiGroups: + - catalog.kubedb.com + resources: + - hanadbversions + verbs: + - get + - list + - watch +- apiGroups: + - kubedb.com + resources: + - hanadbs + verbs: + - get + - list + - watch diff --git a/docs/examples/hanadb/custom-rbac/hanadb-custom-clusterrolebinding.yaml b/docs/examples/hanadb/custom-rbac/hanadb-custom-clusterrolebinding.yaml new file mode 100644 index 000000000..1fd988ef6 --- /dev/null +++ b/docs/examples/hanadb/custom-rbac/hanadb-custom-clusterrolebinding.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: my-custom-clusterrolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: my-custom-clusterrole +subjects: +- kind: ServiceAccount + name: my-custom-serviceaccount + namespace: demo diff --git a/docs/examples/hanadb/custom-rbac/hanadb-custom-db.yaml b/docs/examples/hanadb/custom-rbac/hanadb-custom-db.yaml new file mode 100644 index 000000000..592eaacac --- /dev/null +++ b/docs/examples/hanadb/custom-rbac/hanadb-custom-db.yaml @@ -0,0 +1,20 @@ +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: quick-hanadb + namespace: demo +spec: + version: "2.0.82" + replicas: 1 + storageType: Durable + podTemplate: + spec: + serviceAccountName: my-custom-serviceaccount + storage: + storageClassName: local-path + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 64Gi + deletionPolicy: WipeOut diff --git a/docs/examples/hanadb/custom-rbac/hanadb-custom-role.yaml b/docs/examples/hanadb/custom-rbac/hanadb-custom-role.yaml new file mode 100644 index 000000000..655ce5483 --- /dev/null +++ b/docs/examples/hanadb/custom-rbac/hanadb-custom-role.yaml @@ -0,0 +1,58 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: my-custom-role + namespace: demo +rules: +- apiGroups: + - "" + resources: + - pods + verbs: + - "*" +- apiGroups: + - "" + resources: + - pods/exec + verbs: + - create +- apiGroups: + - kubedb.com + resources: + - hanadbs + verbs: + - get + - list + - watch + - patch +- apiGroups: + - kubedb.com + resources: + - hanadbs/status + verbs: + - patch +- apiGroups: + - "" + resources: + - secrets + verbs: + - get + - list + - create + - update +- apiGroups: + - apps.k8s.appscode.com + resources: + - petsets + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + - configmaps + verbs: + - create + - get + - update diff --git a/docs/examples/hanadb/monitoring/builtin-prom-hanadb.yaml b/docs/examples/hanadb/monitoring/builtin-prom-hanadb.yaml new file mode 100644 index 000000000..f9f5a9512 --- /dev/null +++ b/docs/examples/hanadb/monitoring/builtin-prom-hanadb.yaml @@ -0,0 +1,22 @@ +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: builtin-prom-hanadb + namespace: demo +spec: + version: "2.0.82" + replicas: 1 + storageType: Durable + storage: + storageClassName: local-path + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 64Gi + deletionPolicy: WipeOut + monitor: + agent: prometheus.io/builtin + prometheus: + exporter: + port: 9668 diff --git a/docs/examples/hanadb/monitoring/coreos-prom-hanadb.yaml b/docs/examples/hanadb/monitoring/coreos-prom-hanadb.yaml new file mode 100644 index 000000000..218542f04 --- /dev/null +++ b/docs/examples/hanadb/monitoring/coreos-prom-hanadb.yaml @@ -0,0 +1,26 @@ +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: coreos-prom-hanadb + namespace: demo +spec: + version: "2.0.82" + replicas: 1 + storageType: Durable + storage: + storageClassName: local-path + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 64Gi + deletionPolicy: WipeOut + monitor: + agent: prometheus.io/operator + prometheus: + exporter: + port: 9668 + serviceMonitor: + labels: + release: prometheus + interval: 10s diff --git a/docs/examples/hanadb/private-registry/pvt-hanadbversion.yaml b/docs/examples/hanadb/private-registry/pvt-hanadbversion.yaml new file mode 100644 index 000000000..7dae9b773 --- /dev/null +++ b/docs/examples/hanadb/private-registry/pvt-hanadbversion.yaml @@ -0,0 +1,18 @@ +apiVersion: catalog.kubedb.com/v1alpha1 +kind: HanaDBVersion +metadata: + name: "2.0.82-private" +spec: + coordinator: + image: PRIVATE_REGISTRY/hanadb-coordinator:v0.4.0 + db: + image: PRIVATE_REGISTRY/hanaexpress:2.00.082.00.20250528.1 + exporter: + image: PRIVATE_REGISTRY/hanadb-exporter:1.0.0 + securityContext: + runAsGroup: 79 + runAsUser: 12000 + updateConstraints: + allowlist: + - 2.0.82-private + version: "2.0.82" diff --git a/docs/examples/hanadb/private-registry/pvt-reg-hanadb.yaml b/docs/examples/hanadb/private-registry/pvt-reg-hanadb.yaml new file mode 100644 index 000000000..6f18833dd --- /dev/null +++ b/docs/examples/hanadb/private-registry/pvt-reg-hanadb.yaml @@ -0,0 +1,21 @@ +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: pvt-reg-hanadb + namespace: demo +spec: + version: "2.0.82-private" + replicas: 1 + storageType: Durable + storage: + storageClassName: local-path + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 64Gi + podTemplate: + spec: + imagePullSecrets: + - name: myregistrykey + deletionPolicy: WipeOut diff --git a/docs/examples/hanadb/quickstart/quick-hanadb.yaml b/docs/examples/hanadb/quickstart/quick-hanadb.yaml new file mode 100644 index 000000000..31224b9c4 --- /dev/null +++ b/docs/examples/hanadb/quickstart/quick-hanadb.yaml @@ -0,0 +1,17 @@ +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: quick-hanadb + namespace: demo +spec: + version: "2.0.82" + replicas: 1 + storageType: Durable + storage: + storageClassName: local-path + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 64Gi + deletionPolicy: Delete diff --git a/docs/examples/hanadb/quickstart/system-replication.yaml b/docs/examples/hanadb/quickstart/system-replication.yaml index 9a87c6fcb..b15820948 100644 --- a/docs/examples/hanadb/quickstart/system-replication.yaml +++ b/docs/examples/hanadb/quickstart/system-replication.yaml @@ -5,7 +5,7 @@ metadata: namespace: demo spec: version: "2.0.82" - replicas: 2 + replicas: 3 storageType: Durable topology: mode: SystemReplication diff --git a/docs/guides/hanadb/README.md b/docs/guides/hanadb/README.md index 7361de58d..cc95347c7 100644 --- a/docs/guides/hanadb/README.md +++ b/docs/guides/hanadb/README.md @@ -17,17 +17,25 @@ aliases: # Overview -KubeDB supports SAP HANA through the `HanaDB` CRD with standalone and system replication topology. +KubeDB supports SAP HANA through the `HanaDB` CRD. You can provision standalone SAP HANA instances or system replication clusters from Kubernetes. ## Supported HanaDB Features | Features | Availability | |---------------------------------------------------------------|:------------:| -| Provisioning in Standalone mode | ✓ | -| Provisioning in System Replication mode | ✓ | +| Provisioning in Standalone mode | ✓ | +| Provisioning in System Replication mode | ✓ | | Custom configuration and auth secret | ✓ | -| Non-root deployment customization | ✓ | -| Monitoring | ✓ | +| Custom pod template and service account | ✓ | +| Private registry images | ✓ | +| Built-in Prometheus discovery | ✓ | +| Prometheus Operator monitoring | ✓ | + +## Supported HanaDB Versions + +KubeDB supports the following SAP HANA version: + +- `2.0.82` ## Example HanaDB Manifest @@ -39,7 +47,7 @@ metadata: namespace: demo spec: version: "2.0.82" - replicas: 2 + replicas: 3 storageType: "Durable" topology: mode: SystemReplication @@ -56,9 +64,11 @@ spec: ## User Guide -- [Quickstart HanaDB](/docs/guides/hanadb/quickstart/quickstart.md) with KubeDB operator. -- [HanaDB CRD Concept](/docs/guides/hanadb/concepts/hanadb.md). -- [HanaDBVersion CRD Concept](/docs/guides/hanadb/concepts/catalog.md). -- [HanaDBOpsRequest CRD Concept](/docs/guides/hanadb/concepts/opsrequest.md). +- [HanaDB Quickstart](/docs/guides/hanadb/quickstart/quickstart.md) with KubeDB operator. +- [HanaDB CRD](/docs/guides/hanadb/concepts/hanadb.md). +- [HanaDBVersion CRD](/docs/guides/hanadb/concepts/catalog.md). +- [AppBinding](/docs/guides/hanadb/concepts/appbinding.md). +- [Standalone and System Replication](/docs/guides/hanadb/clustering/system-replication.md). +- [Custom Configuration](/docs/guides/hanadb/configuration/using-config-file.md). +- [Private Registry](/docs/guides/hanadb/private-registry/using-private-registry.md). - [Monitoring](/docs/guides/hanadb/monitoring/overview.md) for metrics collection guidance. -- [Ops Request](/docs/guides/hanadb/ops-request/overview.md). \ No newline at end of file diff --git a/docs/guides/hanadb/clustering/_index.md b/docs/guides/hanadb/clustering/_index.md new file mode 100644 index 000000000..8150316ca --- /dev/null +++ b/docs/guides/hanadb/clustering/_index.md @@ -0,0 +1,10 @@ +--- +title: HanaDB Clustering +menu: + docs_{{ .version }}: + identifier: hanadb-clustering + name: Clustering + parent: hanadb-guides + weight: 25 +menu_name: docs_{{ .version }} +--- diff --git a/docs/guides/hanadb/clustering/standalone.md b/docs/guides/hanadb/clustering/standalone.md new file mode 100644 index 000000000..ae2e7a93c --- /dev/null +++ b/docs/guides/hanadb/clustering/standalone.md @@ -0,0 +1,76 @@ +--- +title: HanaDB Standalone +menu: + docs_{{ .version }}: + identifier: hanadb-standalone-clustering + name: Standalone + parent: hanadb-clustering + weight: 10 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# HanaDB Standalone + +This guide shows how to run a single SAP HANA instance using KubeDB. + +## Before You Begin + +- Prepare a Kubernetes cluster and configure `kubectl`. +- Install KubeDB following the steps [here](/docs/setup/README.md). +- Create a namespace for this tutorial: + +```bash +$ kubectl create ns demo +namespace/demo created +``` + +> Note: YAML files used in this tutorial are stored in [docs/examples/hanadb/clustering](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/hanadb/clustering). + +## Deploy a Standalone Instance + +The following manifest creates a standalone HanaDB instance. If `spec.topology` is omitted, KubeDB treats the database as standalone and requires `spec.replicas: 1`. + +```yaml +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: hana-standalone + namespace: demo +spec: + version: "2.0.82" + replicas: 1 + storageType: Durable + storage: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 64Gi + storageClassName: local-path + deletionPolicy: WipeOut +``` + +Create the database: + +```bash +$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/clustering/standalone.yaml +hanadb.kubedb.com/hana-standalone created +``` + +Wait for the database to become ready: + +```bash +$ kubectl get hanadb -n demo hana-standalone +NAME VERSION STATUS AGE +hana-standalone 2.0.82 Ready 5m +``` + +## Cleaning up + +```bash +kubectl delete hanadb -n demo hana-standalone +kubectl delete ns demo +``` diff --git a/docs/guides/hanadb/clustering/system-replication.md b/docs/guides/hanadb/clustering/system-replication.md new file mode 100644 index 000000000..f9fe87241 --- /dev/null +++ b/docs/guides/hanadb/clustering/system-replication.md @@ -0,0 +1,225 @@ +--- +title: HanaDB System Replication +menu: + docs_{{ .version }}: + identifier: hanadb-system-replication-clustering + name: System Replication + parent: hanadb-clustering + weight: 20 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# HanaDB System Replication + +This guide shows how to run SAP HANA system replication using KubeDB. In this mode, KubeDB creates multiple HanaDB pods and wires SAP HANA system replication between them. The primary service routes write traffic to the current primary pod, and the optional secondary service can expose readable secondary pods when read access is enabled. + +## Before You Begin + +- Prepare a Kubernetes cluster and configure `kubectl`. +- Install KubeDB following the steps [here](/docs/setup/README.md). +- Create a namespace for this tutorial: + +```bash +$ kubectl create ns demo +namespace/demo created +``` + +> Note: YAML files used in this tutorial are stored in [docs/examples/hanadb/clustering](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/hanadb/clustering). + +## Deploy a System Replication Cluster + +The following manifest creates a three-node HanaDB system replication cluster. `spec.topology.mode: SystemReplication` enables SAP HANA system replication. + +The important fields are: + +| Field | Purpose | +|-------|---------| +| `spec.replicas` | Number of HanaDB data pods. This guide uses `3` replicas. | +| `spec.topology.mode` | Must be `SystemReplication` for SAP HANA system replication. | +| `spec.topology.systemReplication.replicationMode` | Controls transaction commit behavior relative to log shipping. Valid values are `sync`, `syncmem`, `async`, and `fullsync`. If omitted, KubeDB defaults it to `sync`. | +| `spec.topology.systemReplication.operationMode` | Controls how the secondary replays logs. Valid values are `logreplay`, `delta_datashipping`, and `logreplay_readaccess`. If omitted, KubeDB defaults it to `logreplay`. | +| `spec.storage.resources.requests.storage` | Persistent volume size for each HanaDB pod. SAP HANA needs a large volume; the examples use `64Gi`. | + +This guide uses `replicationMode: fullsync` and `operationMode: logreplay_readaccess`. With `logreplay_readaccess`, KubeDB creates a secondary service for read-enabled secondaries. + +## Choose Replication and Operation Mode + +System replication behavior is controlled by two fields under `spec.topology.systemReplication`. + +### Replication Mode + +`replicationMode` controls how strongly the primary waits for log shipping before committing transactions. + +| Mode | Use when | +|------|----------| +| `sync` | You want synchronous replication with the default KubeDB behavior. This is the default when `replicationMode` is omitted. | +| `syncmem` | You want synchronous replication where the secondary acknowledges after receiving logs in memory. | +| `async` | You prefer lower write latency and can tolerate more replication lag. | +| `fullsync` | You want the strictest acknowledgement behavior supported by SAP HANA system replication. | + +### Operation Mode + +`operationMode` controls how the secondary receives and replays data. + +| Mode | Read access | Service behavior | +|------|-------------|------------------| +| `logreplay` | Disabled | KubeDB creates the primary service and governing headless service. This is the default when `operationMode` is omitted. | +| `delta_datashipping` | Disabled | KubeDB creates the primary service and governing headless service. | +| `logreplay_readaccess` | Enabled | KubeDB creates the primary service, secondary service, and governing headless service. | + +Read access is enabled only by setting: + +```yaml +topology: + mode: SystemReplication + systemReplication: + operationMode: logreplay_readaccess +``` + +If you do not need read-only traffic on secondary pods, use `operationMode: logreplay` or omit `spec.topology.systemReplication.operationMode`. + +For example, this uses default `sync` + `logreplay` behavior and does not create the secondary read service: + +```yaml +topology: + mode: SystemReplication +``` + +The following example enables strict replication acknowledgment and read access on secondaries: + +```yaml +topology: + mode: SystemReplication + systemReplication: + replicationMode: fullsync + operationMode: logreplay_readaccess +``` + +```yaml +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: hana-cluster + namespace: demo +spec: + version: "2.0.82" + replicas: 3 + storageType: Durable + topology: + mode: SystemReplication + systemReplication: + replicationMode: fullsync + operationMode: logreplay_readaccess + storage: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 64Gi + storageClassName: local-path + deletionPolicy: WipeOut +``` + +Create the database: + +```bash +$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/clustering/system-replication.yaml +hanadb.kubedb.com/hana-cluster created +``` + +Wait for the cluster to become ready: + +```bash +$ kubectl get hanadb -n demo hana-cluster +NAME VERSION STATUS AGE +hana-cluster 2.0.82 Ready 8m +``` + +## Verify System Replication Resources + +Check the pods. Each HanaDB pod should have the database container and the coordinator sidecar running. + +```bash +$ kubectl get pods -n demo --selector="app.kubernetes.io/instance=hana-cluster" +NAME READY STATUS RESTARTS AGE +hana-cluster-0 2/2 Running 0 8m +hana-cluster-1 2/2 Running 0 8m +hana-cluster-2 2/2 Running 0 8m +``` + +Check the services created for the cluster: + +```bash +$ kubectl get svc -n demo --selector="app.kubernetes.io/instance=hana-cluster" +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +hana-cluster ClusterIP 10.96.100.10 39017/TCP 8m +secondary-hana-cluster ClusterIP 10.96.100.11 39017/TCP 8m +hana-cluster-pods ClusterIP None 39001/TCP,39017/TCP 8m +``` + +The services have the following roles: + +| Service | Use | +|---------|-----| +| `hana-cluster` | Primary service. Applications should use this service for write traffic. | +| `secondary-hana-cluster` | Secondary service. Created when `operationMode` is `logreplay_readaccess`; applications can use it for read traffic. | +| `hana-cluster-pods` | Headless governing service used for pod DNS and internal cluster coordination. | + +If you use `operationMode: logreplay` or `operationMode: delta_datashipping`, the `secondary-hana-cluster` service is not created because secondary read access is disabled. + +You can also inspect the endpoints to see which pods each service currently selects: + +```bash +$ kubectl get endpoints -n demo hana-cluster secondary-hana-cluster hana-cluster-pods +NAME ENDPOINTS AGE +hana-cluster 10.244.0.12:39017 8m +secondary-hana-cluster 10.244.0.13:39017,10.244.0.14:39017 8m +hana-cluster-pods 10.244.0.12:39017,10.244.0.13:39017 + 4 more 8m +``` + +## Verify Replication Status + +KubeDB checks SAP HANA system replication by querying `SYS.M_SERVICE_REPLICATION` from the primary service. You can run the same check manually. + +First, read the generated SYSTEM user password: + +```bash +$ export HANA_PASSWORD=$(kubectl get secret -n demo hana-cluster-auth -o jsonpath='{.data.password}' | base64 -d) +``` + +Then query the replication status from the primary pod: + +```bash +$ kubectl exec -it -n demo hana-cluster-0 -c hanadb -- hdbsql \ + -u SYSTEM -p "$HANA_PASSWORD" -d SYSTEMDB \ + "SELECT REPLICATION_STATUS, REPLICATION_STATUS_DETAILS, (LAST_LOG_POSITION - REPLAYED_LOG_POSITION) AS REPLAY_BACKLOG FROM SYS.M_SERVICE_REPLICATION" +REPLICATION_STATUS REPLICATION_STATUS_DETAILS REPLAY_BACKLOG +ACTIVE Connected 0 +ACTIVE Connected 0 +``` + +The cluster is healthy when every secondary reports `ACTIVE` and the replay backlog is `0` or close to `0`. During startup, the status may temporarily show `SYNCING` or `INITIALIZING`. + +## Connect to HanaDB + +Applications should connect to the primary service for writes: + +```bash +hana-cluster.demo.svc:39017 +``` + +If you selected `operationMode: logreplay_readaccess`, read-only clients can connect to the secondary service: + +```bash +secondary-hana-cluster.demo.svc:39017 +``` + +## Cleaning up + +```bash +kubectl delete hanadb -n demo hana-cluster +kubectl delete ns demo +``` diff --git a/docs/guides/hanadb/concepts/_index.md b/docs/guides/hanadb/concepts/_index.md index e0ea9f7b5..9854781f1 100644 --- a/docs/guides/hanadb/concepts/_index.md +++ b/docs/guides/hanadb/concepts/_index.md @@ -5,6 +5,6 @@ menu: identifier: hanadb-concepts name: Concepts parent: hanadb-guides - weight: 15 + weight: 20 menu_name: docs_{{ .version }} ---- \ No newline at end of file +--- diff --git a/docs/guides/hanadb/concepts/appbinding.md b/docs/guides/hanadb/concepts/appbinding.md new file mode 100644 index 000000000..49ed486c1 --- /dev/null +++ b/docs/guides/hanadb/concepts/appbinding.md @@ -0,0 +1,67 @@ +--- +title: AppBinding CRD +menu: + docs_{{ .version }}: + identifier: hanadb-appbinding-concepts + name: AppBinding + parent: hanadb-concepts + weight: 20 +menu_name: docs_{{ .version }} +section_menu_id: guides +--- + +> New to KubeDB? Please start [here](/docs/README.md). + +# AppBinding + +## What is AppBinding? + +An `AppBinding` is a Kubernetes custom resource that points to an application using either a Kubernetes service or an external URL, along with optional parameters and a credential secret. + +KubeDB creates an `AppBinding` automatically for each `HanaDB` object. Applications and other operators can use this object to discover the service endpoint and credentials for the SAP HANA database. + +## AppBinding Specification + +An `AppBinding` object created by KubeDB for a HanaDB instance looks like this: + +```yaml +apiVersion: appcatalog.appscode.com/v1alpha1 +kind: AppBinding +metadata: + name: hana-cluster + namespace: demo + labels: + app.kubernetes.io/component: database + app.kubernetes.io/instance: hana-cluster + app.kubernetes.io/managed-by: kubedb.com + app.kubernetes.io/name: hanadbs.kubedb.com +spec: + appRef: + apiGroup: kubedb.com + kind: HanaDB + name: hana-cluster + namespace: demo + clientConfig: + service: + name: hana-cluster + path: / + port: 39017 + scheme: tcp + secret: + name: hana-cluster-auth + type: kubedb.com/hanadb + version: "2.0.82" +``` + +## Key fields + +- `spec.type` identifies the application type as `kubedb.com/hanadb`. +- `spec.appRef` points back to the source `HanaDB` object. +- `spec.clientConfig.service` contains the in-cluster service endpoint for SAP HANA. +- `spec.secret.name` points to the secret containing the database credentials. +- `spec.version` is the SAP HANA version resolved from the `HanaDBVersion` catalog. + +## Next Steps + +- Read the [HanaDB CRD](/docs/guides/hanadb/concepts/hanadb.md). +- Run the [HanaDB quickstart](/docs/guides/hanadb/quickstart/quickstart.md). diff --git a/docs/guides/hanadb/concepts/catalog.md b/docs/guides/hanadb/concepts/catalog.md index 969e05a0a..aad7ea518 100644 --- a/docs/guides/hanadb/concepts/catalog.md +++ b/docs/guides/hanadb/concepts/catalog.md @@ -4,7 +4,7 @@ menu: docs_{{ .version }}: identifier: hanadb-catalog-concepts name: HanaDBVersion - parent: hanadb-concepts-hanadb + parent: hanadb-concepts weight: 15 menu_name: docs_{{ .version }} section_menu_id: guides @@ -14,9 +14,9 @@ section_menu_id: guides # HanaDBVersion -## What is HanaDBVersion +## What is HanaDBVersion? -`HanaDBVersion` is the catalog CRD that maps a HanaDB version string to the container images and metadata used by KubeDB. +`HanaDBVersion` is the catalog custom resource that maps a HanaDB version string to the container images and metadata used by KubeDB. KubeDB resolves `HanaDB.spec.version` through this catalog. @@ -31,11 +31,16 @@ spec: coordinator: image: ghcr.io/kubedb/hanadb-coordinator:v0.4.0 db: - image: "kubedb/hanadb:2.0.82" + image: docker.io/saplabs/hanaexpress:2.00.082.00.20250528.1 exporter: image: ghcr.io/kubedb/hanadb-exporter:1.0.0 + securityContext: + runAsGroup: 79 + runAsUser: 12000 + updateConstraints: + allowlist: + - 2.0.82 version: "2.0.82" - deprecated: false ``` ## Key fields @@ -45,9 +50,11 @@ spec: - `spec.coordinator.image` points to the coordinator sidecar image. - `spec.db.image` points to the image used for database pods. - `spec.exporter.image` points to the metrics exporter image. +- `spec.securityContext` provides the default user and group used by database containers. +- `spec.updateConstraints.allowlist` lists the versions this catalog entry can update to. - `spec.deprecated` marks versions that are not recommended for new use. ## Next Steps -- Read the [HanaDB CRD concept](/docs/guides/hanadb/concepts/hanadb.md). -- Run the [HanaDB quickstart](/docs/guides/hanadb/quickstart/quickstart.md). \ No newline at end of file +- Read the [HanaDB CRD](/docs/guides/hanadb/concepts/hanadb.md). +- Run the [HanaDB quickstart](/docs/guides/hanadb/quickstart/quickstart.md). diff --git a/docs/guides/hanadb/concepts/hanadb.md b/docs/guides/hanadb/concepts/hanadb.md index d6e4eb4d2..80098bca2 100644 --- a/docs/guides/hanadb/concepts/hanadb.md +++ b/docs/guides/hanadb/concepts/hanadb.md @@ -14,9 +14,9 @@ section_menu_id: guides # HanaDB -## What is HanaDB +## What is HanaDB? -`HanaDB` is a Kubernetes `CustomResourceDefinition` (CRD) in KubeDB to run SAP HANA databases in a Kubernetes-native way. +`HanaDB` is a KubeDB custom resource for running SAP HANA databases in Kubernetes. ## HanaDB Spec @@ -28,7 +28,7 @@ metadata: namespace: demo spec: version: "2.0.82" - replicas: 2 + replicas: 3 storageType: "Durable" topology: mode: SystemReplication @@ -46,9 +46,9 @@ spec: ### Key fields - `spec.version` refers to a `HanaDBVersion`. -- `spec.replicas` controls number of database instances. -- `spec.topology.mode` supports `Standalone` and `SystemReplication`. +- `spec.replicas` controls the number of database instances. +- `spec.topology.mode` supports `Standalone` and `SystemReplication`. If `topology` is omitted, KubeDB runs a standalone instance. - `spec.topology.systemReplication` configures replication and operation mode. - `spec.storageType` and `spec.storage` define persistent data configuration. - `spec.authSecret`, `spec.configuration`, `spec.podTemplate`, and `spec.monitor` are optional tuning controls. -- `spec.deletionPolicy` controls cleanup behavior. \ No newline at end of file +- `spec.deletionPolicy` controls cleanup behavior. diff --git a/docs/guides/hanadb/concepts/opsrequest.md b/docs/guides/hanadb/concepts/opsrequest.md deleted file mode 100644 index d528bc170..000000000 --- a/docs/guides/hanadb/concepts/opsrequest.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: HanaDBOpsRequest CRD -menu: - docs_{{ .version }}: - identifier: hanadb-opsrequest-concepts - name: HanaDBOpsRequest - parent: hanadb-concepts-hanadb - weight: 25 -menu_name: docs_{{ .version }} -section_menu_id: guides ---- - -> New to KubeDB? Please start [here](/docs/README.md). - -# HanaDBOpsRequest - -## What is HanaDBOpsRequest - -`HanaDBOpsRequest` is the operations CRD KubeDB uses for day-2 lifecycle changes of HanaDB databases when supported in a release. - -## Current support status - -Based on [new_db.md](/new_db.md), no HanaDB operation types are currently listed. - -## Expected CRD shape - -```yaml -apiVersion: ops.kubedb.com/v1alpha1 -kind: HanaDBOpsRequest -metadata: - name: hanadb-ops-sample - namespace: demo -spec: - type: Restart - databaseRef: - name: hana-cluster -``` - -## Next Steps - -- Track [HanaDB ops overview](/docs/guides/hanadb/ops-request/overview.md) for support updates. -- Use [HanaDB monitoring guide](/docs/guides/hanadb/monitoring/overview.md) for day-2 operational readiness. \ No newline at end of file diff --git a/docs/guides/hanadb/configuration/_index.md b/docs/guides/hanadb/configuration/_index.md index efe02bcd6..0ee932820 100644 --- a/docs/guides/hanadb/configuration/_index.md +++ b/docs/guides/hanadb/configuration/_index.md @@ -5,6 +5,6 @@ menu: identifier: hanadb-configuration name: Custom Configuration parent: hanadb-guides - weight: 130 + weight: 30 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/hanadb/configuration/using-config-file.md b/docs/guides/hanadb/configuration/using-config-file.md index 8bfdff030..01b0af8c0 100644 --- a/docs/guides/hanadb/configuration/using-config-file.md +++ b/docs/guides/hanadb/configuration/using-config-file.md @@ -14,13 +14,13 @@ section_menu_id: guides # Using Custom Configuration File -KubeDB supports providing custom configuration for HanaDB. This tutorial will show you how to use KubeDB to run HanaDB with custom configuration. +KubeDB supports user-provided SAP HANA configuration. This tutorial shows how to run HanaDB with a custom `global.ini` file. ## Before You Begin -- At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). +- Prepare a Kubernetes cluster and configure `kubectl` to communicate with it. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). -- Now, install KubeDB cli on your workstation and KubeDB operator in your cluster following the steps [here](/docs/setup/README.md). +- Install the KubeDB CLI on your workstation and the KubeDB operator in your cluster by following the steps [here](/docs/setup/README.md). - To keep things isolated, this tutorial uses a separate namespace called `demo` throughout this tutorial. @@ -29,33 +29,34 @@ $ kubectl create ns demo namespace/demo created ``` -> Note: YAML files used in this tutorial are stored in [docs/examples/hanadb](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/hanadb) folder in GitHub repository [kubedb/docs](https://github.com/kubedb/docs). +> Note: YAML files used in this tutorial are stored in [docs/examples/hanadb/configuration](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/hanadb/configuration) folder in GitHub repository [kubedb/docs](https://github.com/kubedb/docs). ## Overview -SAP HANA allows configuration via the `global.ini` and `indexserver.ini` configuration files. KubeDB takes advantage of the `spec.configuration.secretName` field to allow users to provide their custom configuration without mounting any volume into the Pod. +KubeDB supports custom HanaDB configuration through a user-provided `global.ini` file. The `spec.configuration.secretName` field lets you provide this configuration without manually mounting any volume into the pod. To apply custom configuration, you create a Kubernetes Secret containing your custom config file and provide its name in `spec.configuration.secretName`. The operator reads this Secret internally and applies the configuration automatically. -In this tutorial, we will configure `indexserver.ini` with a custom `max_memory` parameter. +In this tutorial, you configure `global.ini` with a custom memory allocation limit. ## Custom Configuration -At first, let's create a custom `global.ini` file: +Create a Secret that contains a custom `global.ini` file: -```ini -[system] -usage = development - -[memorymanager] -alloclimit = 16384 +```yaml +apiVersion: v1 +kind: Secret +metadata: + name: hanadb-configuration + namespace: demo +stringData: + global.ini: | + [memorymanager] + global_allocation_limit = 8589934592 ``` -Now, create a Secret with this configuration file. - ```bash -$ kubectl create secret generic -n demo hanadb-configuration \ - --from-file=global.ini=./global.ini +$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/configuration/hanadb-configuration.yaml secret/hanadb-configuration created ``` @@ -72,7 +73,7 @@ metadata: namespace: demo ``` -Now, create HanaDB CRD specifying `spec.configuration.secretName` field. +Create a HanaDB object with `spec.configuration.secretName` set to the Secret name. ```yaml apiVersion: kubedb.com/v1alpha2 @@ -87,26 +88,26 @@ spec: secretName: hanadb-configuration storageType: Durable storage: - storageClassName: "standard" + storageClassName: local-path accessModes: - ReadWriteOnce resources: requests: - storage: 10Gi + storage: 64Gi deletionPolicy: WipeOut ``` ```bash -$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/configuration/hanadb-configuration.yaml +$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/configuration/custom-hanadb.yaml hanadb.kubedb.com/custom-hanadb created ``` -Now, wait for the HanaDB to be ready. +Wait for the HanaDB instance to become ready. ```bash $ kubectl get hanadb -n demo custom-hanadb NAME VERSION STATUS AGE -custom-hanadb 2.0 Ready 5m +custom-hanadb 2.0.82 Ready 5m ``` Check that the pod is running: @@ -117,23 +118,21 @@ NAME READY STATUS RESTARTS AGE custom-hanadb-0 1/1 Running 0 5m ``` -Now, we will check if the database has started with the custom configuration we have provided. We will `exec` into the pod and use the HDB CLI to check the configuration. +Check whether the database started with the custom configuration by running `hdbsql` inside the pod. ```bash $ kubectl exec -it -n demo custom-hanadb-0 -- hdbsql \ -u SYSTEM -p \ - "SELECT KEY, VALUE FROM SYS.M_INIFILE_CONTENTS WHERE FILE_NAME = 'global.ini' AND KEY = 'alloclimit'" -KEY VALUE -alloclimit 16384 + "SELECT KEY, VALUE FROM SYS.M_INIFILE_CONTENTS WHERE FILE_NAME = 'global.ini' AND KEY = 'global_allocation_limit'" +KEY VALUE +global_allocation_limit 8589934592 ``` -## Reconfiguring - -If you want to change the configuration, you can update the Secret and then trigger a reconfigure OpsRequest. For more details, see the [Reconfigure](/docs/guides/hanadb/ops-request/overview.md) section. +This guide covers initial custom configuration during provisioning. ## Cleaning up -To cleanup the Kubernetes resources created by this tutorial, run: +To clean up the Kubernetes resources created by this tutorial, run: ```bash kubectl patch -n demo hanadb/custom-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" diff --git a/docs/guides/hanadb/custom-rbac/_index.md b/docs/guides/hanadb/custom-rbac/_index.md index 4304ca94f..97578bdfc 100644 --- a/docs/guides/hanadb/custom-rbac/_index.md +++ b/docs/guides/hanadb/custom-rbac/_index.md @@ -1,10 +1,10 @@ --- -title: Run HanaDB with Custom RBAC resources +title: Run HanaDB with Custom RBAC Resources menu: docs_{{ .version }}: identifier: hanadb-custom-rbac name: Custom RBAC parent: hanadb-guides - weight: 90 + weight: 35 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/hanadb/custom-rbac/using-custom-rbac.md b/docs/guides/hanadb/custom-rbac/using-custom-rbac.md index dc4a58a7d..c13fc0066 100644 --- a/docs/guides/hanadb/custom-rbac/using-custom-rbac.md +++ b/docs/guides/hanadb/custom-rbac/using-custom-rbac.md @@ -1,5 +1,5 @@ --- -title: Run HanaDB with Custom RBAC resources +title: Run HanaDB with Custom RBAC Resources menu: docs_{{ .version }}: identifier: hanadb-custom-rbac-quickstart @@ -14,13 +14,13 @@ section_menu_id: guides # Using Custom RBAC Resources -KubeDB supports finer user control over role based access permissions provided to a HanaDB instance. This tutorial will show you how to use KubeDB to run HanaDB instance with custom RBAC resources. +KubeDB supports user-managed role-based access permissions for HanaDB. This tutorial shows how to run a HanaDB instance with custom RBAC resources. ## Before You Begin -At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). +Prepare a Kubernetes cluster and configure `kubectl` to communicate with it. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). -Now, install KubeDB cli on your workstation and KubeDB operator in your cluster following the steps [here](/docs/setup/README.md). +Install the KubeDB CLI on your workstation and the KubeDB operator in your cluster by following the steps [here](/docs/setup/README.md). To keep things isolated, this tutorial uses a separate namespace called `demo` throughout this tutorial. @@ -31,20 +31,20 @@ namespace/demo created ## Overview -KubeDB allows users to provide custom RBAC resources, namely, `ServiceAccount`, `Role`, and `RoleBinding` for HanaDB. This is provided via the `spec.podTemplate.spec.serviceAccountName` field in HanaDB CRD. If this field is left empty, the KubeDB operator will create a service account name matching the HanaDB CRD name. +KubeDB allows users to provide custom RBAC resources for HanaDB: `ServiceAccount`, `Role`, `RoleBinding`, `ClusterRole`, and `ClusterRoleBinding`. Configure the service account through `spec.podTemplate.spec.serviceAccountName`. If this field is empty, the KubeDB operator creates a service account whose name matches the HanaDB object. -If a service account name is given with an existing service account, the KubeDB operator will use that existing service account. Users are responsible for providing necessary access permissions manually. +If you reference an existing service account, the KubeDB operator uses it. You are responsible for granting the required permissions. ## Custom RBAC for HanaDB -At first, let's create a `Service Account` in `demo` namespace. +Create a `ServiceAccount` in the `demo` namespace. ```bash $ kubectl create serviceaccount -n demo my-custom-serviceaccount serviceaccount/my-custom-serviceaccount created ``` -Now, we need to create a role that has necessary access permissions for the HanaDB database named `quick-hanadb`. +Create a `Role` with the namespace-scoped permissions required by the HanaDB instance named `quick-hanadb`. ```yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -54,34 +54,49 @@ metadata: namespace: demo rules: - apiGroups: - - apps - resourceNames: - - quick-hanadb + - "" resources: - - petsets + - pods verbs: - - get + - "*" +- apiGroups: + - "" + resources: + - pods/exec + verbs: + - create - apiGroups: - kubedb.com - resourceNames: - - quick-hanadb resources: - hanadbs verbs: - get + - list + - watch + - patch - apiGroups: - - "" + - kubedb.com resources: - - pods + - hanadbs/status verbs: - - list - patch - apiGroups: - "" resources: - - pods/exec + - secrets verbs: + - get + - list - create + - update +- apiGroups: + - apps.k8s.appscode.com + resources: + - petsets + verbs: + - get + - list + - watch - apiGroups: - "" resources: @@ -97,7 +112,7 @@ $ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" > role.rbac.authorization.k8s.io/my-custom-role created ``` -Now create a `RoleBinding` to bind this `Role` with the already created service account. +Create a `RoleBinding` to bind this `Role` to the custom service account. ```bash $ kubectl create rolebinding my-custom-rolebinding \ @@ -107,7 +122,60 @@ $ kubectl create rolebinding my-custom-rolebinding \ rolebinding.rbac.authorization.k8s.io/my-custom-rolebinding created ``` -Now, create a HanaDB CRD specifying `spec.podTemplate.spec.serviceAccountName` field to `my-custom-serviceaccount`. +Create the cluster-scoped permissions required by the HanaDB pod. + +```yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: my-custom-clusterrole +rules: +- apiGroups: + - catalog.kubedb.com + resources: + - hanadbversions + verbs: + - get + - list + - watch +- apiGroups: + - kubedb.com + resources: + - hanadbs + verbs: + - get + - list + - watch +``` + +```bash +$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/custom-rbac/hanadb-custom-clusterrole.yaml +clusterrole.rbac.authorization.k8s.io/my-custom-clusterrole created +``` + +Bind the `ClusterRole` with the custom service account. + +```yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: my-custom-clusterrolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: my-custom-clusterrole +subjects: +- kind: ServiceAccount + name: my-custom-serviceaccount + namespace: demo +``` + +```bash +$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/custom-rbac/hanadb-custom-clusterrolebinding.yaml +clusterrolebinding.rbac.authorization.k8s.io/my-custom-clusterrolebinding created +``` + +Create a HanaDB object with `spec.podTemplate.spec.serviceAccountName` set to `my-custom-serviceaccount`. ```yaml apiVersion: kubedb.com/v1alpha2 @@ -123,12 +191,12 @@ spec: spec: serviceAccountName: my-custom-serviceaccount storage: - storageClassName: "standard" + storageClassName: local-path accessModes: - ReadWriteOnce resources: requests: - storage: 10Gi + storage: 64Gi deletionPolicy: WipeOut ``` @@ -147,7 +215,7 @@ quick-hanadb-0 1/1 Running 0 5m ## Cleaning up -To cleanup the Kubernetes resources created by this tutorial, run: +To clean up the Kubernetes resources created by this tutorial, run: ```bash kubectl patch -n demo hanadb/quick-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" @@ -156,5 +224,7 @@ kubectl delete -n demo hanadb/quick-hanadb kubectl delete -n demo serviceaccount my-custom-serviceaccount kubectl delete -n demo role my-custom-role kubectl delete -n demo rolebinding my-custom-rolebinding +kubectl delete clusterrole my-custom-clusterrole +kubectl delete clusterrolebinding my-custom-clusterrolebinding kubectl delete ns demo ``` diff --git a/docs/guides/hanadb/monitoring/_index.md b/docs/guides/hanadb/monitoring/_index.md index e7f7b1a87..8f16ebc00 100644 --- a/docs/guides/hanadb/monitoring/_index.md +++ b/docs/guides/hanadb/monitoring/_index.md @@ -5,6 +5,6 @@ menu: identifier: hanadb-monitoring name: Monitoring parent: hanadb-guides - weight: 20 + weight: 90 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/hanadb/monitoring/overview.md b/docs/guides/hanadb/monitoring/overview.md index d94268b3f..f8d838d9b 100644 --- a/docs/guides/hanadb/monitoring/overview.md +++ b/docs/guides/hanadb/monitoring/overview.md @@ -10,30 +10,67 @@ menu_name: docs_{{ .version }} section_menu_id: guides --- +> New to KubeDB? Please start [here](/docs/README.md). + # HanaDB Monitoring -This guide shows how to enable and verify monitoring for HanaDB. +KubeDB has native support for monitoring HanaDB via [Prometheus](https://prometheus.io/). You can use built-in Prometheus discovery or Prometheus Operator to monitor KubeDB-managed HanaDB instances. ## Before You Begin - Deploy HanaDB first using the [quickstart guide](/docs/guides/hanadb/quickstart/quickstart.md). -- Install Prometheus Operator or another monitoring stack that can scrape Kubernetes targets. +- Install Prometheus Operator or another monitoring stack that can scrape Kubernetes services. + +## Overview + +When you create a HanaDB object with `spec.monitor` configured, KubeDB injects the HanaDB exporter sidecar into the database pod. KubeDB also creates a stats service named `{hanadb-name}-stats` for scraping the exporter endpoint. -## Enable Monitoring +## Configure Monitoring HanaDB monitoring is configured via `spec.monitor`. -- Use Prometheus operator-based scraping where available. -- Ensure metrics endpoints are reachable from the monitoring namespace. +| Field | Type | Uses | +|---------------------------------------------------|------------|------| +| `spec.monitor.agent` | `Required` | Monitoring agent type. Use `prometheus.io/builtin` or `prometheus.io/operator`. | +| `spec.monitor.prometheus.exporter.port` | `Optional` | Port where the exporter sidecar serves metrics. Defaults to `9668`. | +| `spec.monitor.prometheus.exporter.args` | `Optional` | Arguments passed to the exporter sidecar. | +| `spec.monitor.prometheus.exporter.env` | `Optional` | Environment variables set in the exporter sidecar. | +| `spec.monitor.prometheus.exporter.resources` | `Optional` | Resource requirements for the exporter sidecar. | +| `spec.monitor.prometheus.serviceMonitor.labels` | `Optional` | Labels added to the `ServiceMonitor` for Prometheus selection. | +| `spec.monitor.prometheus.serviceMonitor.interval` | `Optional` | Scrape interval for Prometheus Operator. | -## Verify +## Sample Configuration -```bash -kubectl get hanadb -n demo hana-cluster -o yaml -kubectl get servicemonitor -A +```yaml +apiVersion: kubedb.com/v1alpha2 +kind: HanaDB +metadata: + name: coreos-prom-hanadb + namespace: demo +spec: + version: "2.0.82" + replicas: 1 + storageType: Durable + storage: + storageClassName: local-path + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 64Gi + monitor: + agent: prometheus.io/operator + prometheus: + exporter: + port: 9668 + serviceMonitor: + labels: + release: prometheus + interval: 10s + deletionPolicy: WipeOut ``` ## Next Steps -- Add alerts for pod health, storage usage, and replication status. -- Review your Prometheus targets after every database topology change. +- Learn how to monitor HanaDB using [Prometheus Operator](/docs/guides/hanadb/monitoring/using-prometheus-operator.md). +- Learn how to monitor HanaDB using [built-in Prometheus discovery](/docs/guides/hanadb/monitoring/using-builtin-prometheus.md). diff --git a/docs/guides/hanadb/monitoring/using-builtin-prometheus.md b/docs/guides/hanadb/monitoring/using-builtin-prometheus.md index d610f2e49..34843a095 100644 --- a/docs/guides/hanadb/monitoring/using-builtin-prometheus.md +++ b/docs/guides/hanadb/monitoring/using-builtin-prometheus.md @@ -1,9 +1,9 @@ --- -title: Monitor HanaDB using Builtin Prometheus Discovery +title: Monitor HanaDB using Built-in Prometheus Discovery menu: docs_{{ .version }}: identifier: hanadb-using-builtin-prometheus-monitoring - name: Builtin Prometheus + name: Built-in Prometheus parent: hanadb-monitoring weight: 20 menu_name: docs_{{ .version }} @@ -12,13 +12,13 @@ section_menu_id: guides > New to KubeDB? Please start [here](/docs/README.md). -# Monitoring HanaDB with Builtin Prometheus +# Monitoring HanaDB with Built-in Prometheus -This tutorial will show you how to monitor HanaDB database using builtin [Prometheus](https://github.com/prometheus/prometheus) scraper. +This tutorial shows how to monitor a HanaDB instance using the built-in [Prometheus](https://github.com/prometheus/prometheus) scraper. ## Before You Begin -- At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). +- Prepare a Kubernetes cluster and configure `kubectl` to communicate with it. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). - Install KubeDB operator in your cluster following the steps [here](/docs/setup/README.md). @@ -26,7 +26,7 @@ This tutorial will show you how to monitor HanaDB database using builtin [Promet - To learn how Prometheus monitoring works with KubeDB in general, please visit [here](/docs/guides/hanadb/monitoring/overview.md). -- To keep Prometheus resources isolated, we are going to use a separate namespace called `monitoring` to deploy respective monitoring resources. We are going to deploy the database in `demo` namespace. +- This tutorial deploys Prometheus resources in the `monitoring` namespace and the database in the `demo` namespace. ```bash $ kubectl create ns monitoring @@ -36,11 +36,11 @@ This tutorial will show you how to monitor HanaDB database using builtin [Promet namespace/demo created ``` -> Note: YAML files used in this tutorial are stored in [docs/examples/hanadb](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/hanadb) folder in GitHub repository [kubedb/docs](https://github.com/kubedb/docs). +> Note: YAML files used in this tutorial are stored in [docs/examples/hanadb/monitoring](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/hanadb/monitoring) folder in GitHub repository [kubedb/docs](https://github.com/kubedb/docs). ## Deploy HanaDB with Monitoring Enabled -At first, let's deploy a HanaDB database with monitoring enabled. Below is the HanaDB object that we are going to create. +Deploy a HanaDB instance with monitoring enabled. The manifest is shown below. ```yaml apiVersion: kubedb.com/v1alpha2 @@ -53,44 +53,47 @@ spec: replicas: 1 storageType: Durable storage: - storageClassName: "standard" + storageClassName: local-path accessModes: - ReadWriteOnce resources: requests: - storage: 10Gi + storage: 64Gi deletionPolicy: WipeOut monitor: agent: prometheus.io/builtin + prometheus: + exporter: + port: 9668 ``` -Here, `spec.monitor.agent: prometheus.io/builtin` specifies that we are going to monitor this server using builtin Prometheus scraper. +Here, `spec.monitor.agent: prometheus.io/builtin` tells KubeDB to use Prometheus annotation-based discovery. `spec.monitor.prometheus.exporter.port` specifies the exporter port. If omitted, KubeDB defaults it to `9668`. -Let's create the HanaDB CR we have shown above. +Create the HanaDB object: ```bash $ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/monitoring/builtin-prom-hanadb.yaml hanadb.kubedb.com/builtin-prom-hanadb created ``` -Now, wait for the database to go into `Ready` state. +Wait for the database to reach the `Ready` state. ```bash $ kubectl get hanadb -n demo builtin-prom-hanadb NAME VERSION STATUS AGE -builtin-prom-hanadb 2.0 Ready 2m +builtin-prom-hanadb 2.0.82 Ready 2m ``` -KubeDB will create a separate stats service with name `{HanaDB crd name}-stats` for monitoring purpose. +KubeDB creates a separate stats service named `{hanadb-name}-stats` for metrics scraping. ```bash $ kubectl get svc -n demo --selector="app.kubernetes.io/instance=builtin-prom-hanadb" NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE builtin-prom-hanadb ClusterIP 10.96.100.10 39017/TCP 2m -builtin-prom-hanadb-stats ClusterIP 10.96.100.11 56790/TCP 90s +builtin-prom-hanadb-stats ClusterIP 10.96.100.11 9668/TCP 90s ``` -Here, `builtin-prom-hanadb-stats` service has been created for monitoring purpose. Let's describe the service. +The `builtin-prom-hanadb-stats` service exposes the exporter endpoint. Describe the service: ```bash $ kubectl describe svc -n demo builtin-prom-hanadb-stats @@ -100,24 +103,26 @@ Labels: app.kubernetes.io/name=hanadbs.kubedb.com app.kubernetes.io/instance=builtin-prom-hanadb Annotations: monitoring.appscode.com/agent: prometheus.io/builtin prometheus.io/path: /metrics - prometheus.io/port: 56790 + prometheus.io/port: 9668 + prometheus.io/scheme: http prometheus.io/scrape: true Selector: app.kubernetes.io/name=hanadbs.kubedb.com,app.kubernetes.io/instance=builtin-prom-hanadb Type: ClusterIP -Port: prom-http 56790/TCP +Port: metrics 9668/TCP ``` -You can see that the service contains the following annotations, which are used by builtin Prometheus to discover the endpoint: +The service contains the following annotations, which are used by Prometheus to discover the endpoint: ``` prometheus.io/path: /metrics -prometheus.io/port: 56790 +prometheus.io/port: 9668 +prometheus.io/scheme: http prometheus.io/scrape: true ``` ## Configure Prometheus -Now we need to configure Prometheus to scrape metrics from this service. Add the following `scrape_config` to your Prometheus configuration: +Configure Prometheus to scrape metrics from this service. Add the following `scrape_config` to your Prometheus configuration: ```yaml scrape_configs: @@ -166,7 +171,7 @@ You should see the HanaDB metrics in the Prometheus dashboard under the `kubedb- ## Cleaning up -To cleanup the Kubernetes resources created by this tutorial, run: +To clean up the Kubernetes resources created by this tutorial, run: ```bash kubectl patch -n demo hanadb/builtin-prom-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" diff --git a/docs/guides/hanadb/monitoring/using-prometheus-operator.md b/docs/guides/hanadb/monitoring/using-prometheus-operator.md index 051ae30ba..60c49d611 100644 --- a/docs/guides/hanadb/monitoring/using-prometheus-operator.md +++ b/docs/guides/hanadb/monitoring/using-prometheus-operator.md @@ -14,11 +14,11 @@ section_menu_id: guides # Monitoring HanaDB with Prometheus Operator -This tutorial will show you how to monitor HanaDB database using [Prometheus Operator](https://github.com/prometheus-operator/prometheus-operator). +This tutorial shows how to monitor a HanaDB instance using [Prometheus Operator](https://github.com/prometheus-operator/prometheus-operator). ## Before You Begin -- At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). +- Prepare a Kubernetes cluster and configure `kubectl` to communicate with it. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). - Install KubeDB operator in your cluster following the steps [here](/docs/setup/README.md). @@ -26,7 +26,7 @@ This tutorial will show you how to monitor HanaDB database using [Prometheus Ope - To learn how Prometheus monitoring works with KubeDB in general, please visit [here](/docs/guides/hanadb/monitoring/overview.md). -- To keep Prometheus resources isolated, we are going to use a separate namespace called `monitoring` to deploy respective monitoring resources. We are going to deploy the database in `demo` namespace. +- This tutorial deploys Prometheus resources in the `monitoring` namespace and the database in the `demo` namespace. ```bash $ kubectl create ns monitoring @@ -36,11 +36,11 @@ This tutorial will show you how to monitor HanaDB database using [Prometheus Ope namespace/demo created ``` -> Note: YAML files used in this tutorial are stored in [docs/examples/hanadb](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/hanadb) folder in GitHub repository [kubedb/docs](https://github.com/kubedb/docs). +> Note: YAML files used in this tutorial are stored in [docs/examples/hanadb/monitoring](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/hanadb/monitoring) folder in GitHub repository [kubedb/docs](https://github.com/kubedb/docs). ## Deploy HanaDB with Monitoring Enabled -At first, let's deploy a HanaDB database with monitoring enabled using the Prometheus Operator. +Deploy a HanaDB instance with monitoring enabled using Prometheus Operator. ```yaml apiVersion: kubedb.com/v1alpha2 @@ -53,16 +53,18 @@ spec: replicas: 1 storageType: Durable storage: - storageClassName: "standard" + storageClassName: local-path accessModes: - ReadWriteOnce resources: requests: - storage: 10Gi + storage: 64Gi deletionPolicy: WipeOut monitor: agent: prometheus.io/operator prometheus: + exporter: + port: 9668 serviceMonitor: labels: release: prometheus @@ -72,22 +74,23 @@ spec: Here, - `spec.monitor.agent: prometheus.io/operator` tells KubeDB that we want to monitor using Prometheus Operator. +- `spec.monitor.prometheus.exporter.port` specifies the exporter port. If omitted, KubeDB defaults it to `9668`. - `spec.monitor.prometheus.serviceMonitor.labels` specifies labels to add to the ServiceMonitor. The Prometheus CR must have matching labels in its `serviceMonitorSelector`. - `spec.monitor.prometheus.serviceMonitor.interval` specifies the scrape interval. -Let's create the HanaDB CR: +Create the HanaDB object: ```bash $ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/monitoring/coreos-prom-hanadb.yaml hanadb.kubedb.com/coreos-prom-hanadb created ``` -Now, wait for the database to go into `Ready` state. +Wait for the database to reach the `Ready` state. ```bash $ kubectl get hanadb -n demo coreos-prom-hanadb NAME VERSION STATUS AGE -coreos-prom-hanadb 2.0 Ready 2m +coreos-prom-hanadb 2.0.82 Ready 2m ``` KubeDB will create a ServiceMonitor and stats service for this HanaDB instance. @@ -98,7 +101,7 @@ NAME AGE coreos-prom-hanadb-stats 2m ``` -Let's verify the ServiceMonitor: +Verify the `ServiceMonitor`: ```yaml $ kubectl get servicemonitor -n demo coreos-prom-hanadb-stats -o yaml @@ -118,7 +121,8 @@ spec: - honorLabels: true interval: 10s path: /metrics - port: prom-http + port: metrics + scheme: http namespaceSelector: matchNames: - demo @@ -142,7 +146,7 @@ You should see `demo/coreos-prom-hanadb-stats` target in an UP state. ## Cleaning up -To cleanup the Kubernetes resources created by this tutorial, run: +To clean up the Kubernetes resources created by this tutorial, run: ```bash kubectl patch -n demo hanadb/coreos-prom-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" diff --git a/docs/guides/hanadb/ops-request/_index.md b/docs/guides/hanadb/ops-request/_index.md deleted file mode 100644 index e95ee8530..000000000 --- a/docs/guides/hanadb/ops-request/_index.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: Ops Request -menu: - docs_{{ .version }}: - identifier: hanadb-ops-request - name: Ops Request - parent: hanadb-guides - weight: 30 -menu_name: docs_{{ .version }} ---- diff --git a/docs/guides/hanadb/ops-request/overview.md b/docs/guides/hanadb/ops-request/overview.md deleted file mode 100644 index 669d016df..000000000 --- a/docs/guides/hanadb/ops-request/overview.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: HanaDB Ops Request Overview -menu: - docs_{{ .version }}: - identifier: hanadb-ops-request-overview - name: Overview - parent: hanadb-ops-request - weight: 10 -menu_name: docs_{{ .version }} -section_menu_id: guides ---- - -# HanaDB Ops Request - -This page tracks HanaDB operations supported by the new database matrix used for these guides. - -## Before You Begin - -- Deploy HanaDB first using the [quickstart guide](/docs/guides/hanadb/quickstart/quickstart.md). -- Confirm the current support list in [new_db.md](/new_db.md) for your release. - -## Current Status - -Based on [new_db.md](/new_db.md), no HanaDB ops request types are listed yet. - -## What to Check Next - -- Watch future KubeDB releases for HanaDB `OpsRequest` support. -- Use the monitoring and quickstart guides to validate regular day-2 operations until explicit ops support is added. diff --git a/docs/guides/hanadb/private-registry/_index.md b/docs/guides/hanadb/private-registry/_index.md index 219abddd1..31c60a4be 100644 --- a/docs/guides/hanadb/private-registry/_index.md +++ b/docs/guides/hanadb/private-registry/_index.md @@ -5,6 +5,6 @@ menu: identifier: hanadb-private-registry name: Private Registry parent: hanadb-guides - weight: 120 + weight: 40 menu_name: docs_{{ .version }} --- diff --git a/docs/guides/hanadb/private-registry/using-private-registry.md b/docs/guides/hanadb/private-registry/using-private-registry.md index 80bff9852..6ef6ae85e 100644 --- a/docs/guides/hanadb/private-registry/using-private-registry.md +++ b/docs/guides/hanadb/private-registry/using-private-registry.md @@ -14,11 +14,11 @@ section_menu_id: guides # Using Private Docker Registry -KubeDB supports using private Docker registries. This tutorial will show you how to run KubeDB managed HanaDB database using private Docker images. +KubeDB supports private Docker registries. This tutorial shows how to run a KubeDB-managed HanaDB instance using private images. ## Before You Begin -At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). +Prepare a Kubernetes cluster and configure `kubectl` to communicate with it. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). To keep things isolated, this tutorial uses a separate namespace called `demo` throughout this tutorial. @@ -29,14 +29,14 @@ namespace/demo created ## Prepare Private Docker Registry -- You will also need a docker private [registry](https://docs.docker.com/registry/) or [private repository](https://docs.docker.com/docker-hub/repos/#private-repositories). +- Prepare a private Docker [registry](https://docs.docker.com/registry/) or [private repository](https://docs.docker.com/docker-hub/repos/#private-repositories). -- Push the required images from KubeDB's [Docker hub account](https://hub.docker.com/r/kubedb/) into your private registry. For HanaDB, push the `DB_IMAGE` of the following HanaDBVersions, where `deprecated` is not true, to your private registry. +- Push the required HanaDB images into your private registry. For HanaDB, push the database, coordinator, and exporter images from the active `HanaDBVersion` entries. ```bash - $ kubectl get hanadbversions -o=custom-columns=NAME:.metadata.name,VERSION:.spec.version,DB_IMAGE:.spec.db.image,DEPRECATED:.spec.deprecated - NAME VERSION DB_IMAGE DEPRECATED - 2.0 2.0 kubedb/hanadb:2.0 + $ kubectl get hanadbversions -o=custom-columns=NAME:.metadata.name,VERSION:.spec.version,DB_IMAGE:.spec.db.image,COORDINATOR_IMAGE:.spec.coordinator.image,EXPORTER_IMAGE:.spec.exporter.image,DEPRECATED:.spec.deprecated + NAME VERSION DB_IMAGE COORDINATOR_IMAGE EXPORTER_IMAGE DEPRECATED + 2.0.82 2.0.82 docker.io/saplabs/hanaexpress:2.00.082.00.20250528.1 ghcr.io/kubedb/hanadb-coordinator:v0.4.0 ghcr.io/kubedb/hanadb-exporter:1.0.0 ``` ## Create ImagePullSecret @@ -52,32 +52,38 @@ $ kubectl create secret docker-registry -n demo myregistrykey \ secret/myregistrykey created ``` -## Install KubeDB Operator +## Install the KubeDB Operator -Follow the steps to [install KubeDB operator](/docs/setup/README.md) properly in cluster so that it points to the DOCKER_REGISTRY you wish to pull images from. +Install the [KubeDB operator](/docs/setup/README.md) in your cluster and configure it to use the private registry that hosts the required images. -## Create HanaDBVersion CRD +## Create a HanaDBVersion -Create a HanaDBVersion CRD specifying images from your private registry. Replace `PRIVATE_REGISTRY` with your private registry. +Create a `HanaDBVersion` object that points to images in your private registry. Replace `PRIVATE_REGISTRY` with your registry address. ```yaml apiVersion: catalog.kubedb.com/v1alpha1 kind: HanaDBVersion metadata: - name: "2.0" + name: "2.0.82-private" spec: coordinator: image: PRIVATE_REGISTRY/hanadb-coordinator:v0.4.0 db: - image: PRIVATE_REGISTRY/hanadb:2.0 + image: PRIVATE_REGISTRY/hanaexpress:2.00.082.00.20250528.1 exporter: image: PRIVATE_REGISTRY/hanadb-exporter:1.0.0 + securityContext: + runAsGroup: 79 + runAsUser: 12000 + updateConstraints: + allowlist: + - 2.0.82-private version: "2.0.82" ``` ```bash -$ kubectl apply -f pvt-hanadbversion.yaml -hanadbversion.catalog.kubedb.com/2.0 created +$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/private-registry/pvt-hanadbversion.yaml +hanadbversion.catalog.kubedb.com/2.0.82-private created ``` ## Deploy HanaDB from Private Registry @@ -89,16 +95,16 @@ metadata: name: pvt-reg-hanadb namespace: demo spec: - version: "2.0.82" + version: "2.0.82-private" replicas: 1 storageType: Durable storage: - storageClassName: "standard" + storageClassName: local-path accessModes: - ReadWriteOnce resources: requests: - storage: 10Gi + storage: 64Gi podTemplate: spec: imagePullSecrets: @@ -111,7 +117,7 @@ $ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" hanadb.kubedb.com/pvt-reg-hanadb created ``` -Check that the HanaDB is in Running state: +Check that the HanaDB pod is running: ```bash $ kubectl get pods -n demo --selector="app.kubernetes.io/instance=pvt-reg-hanadb" @@ -121,7 +127,7 @@ pvt-reg-hanadb-0 1/1 Running 0 3m ## Cleaning up -To cleanup the Kubernetes resources created by this tutorial, run: +To clean up the Kubernetes resources created by this tutorial, run: ```bash kubectl patch -n demo hanadb/pvt-reg-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" diff --git a/docs/guides/hanadb/quickstart/_index.md b/docs/guides/hanadb/quickstart/_index.md index 4b201d7d5..084840002 100644 --- a/docs/guides/hanadb/quickstart/_index.md +++ b/docs/guides/hanadb/quickstart/_index.md @@ -7,4 +7,4 @@ menu: parent: hanadb-guides weight: 15 menu_name: docs_{{ .version }} ---- \ No newline at end of file +--- diff --git a/docs/guides/hanadb/quickstart/quickstart.md b/docs/guides/hanadb/quickstart/quickstart.md index 107c57a5f..8b70e20ba 100644 --- a/docs/guides/hanadb/quickstart/quickstart.md +++ b/docs/guides/hanadb/quickstart/quickstart.md @@ -14,7 +14,7 @@ section_menu_id: guides # Running HanaDB -This tutorial shows how to run a HanaDB database with KubeDB. +This tutorial shows how to run a SAP HANA database with KubeDB. > Note: YAML files used in this tutorial are stored in [docs/examples/hanadb/quickstart](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/examples/hanadb/quickstart). @@ -35,13 +35,15 @@ kubectl create ns demo kubectl get storageclass ``` +The example manifests use `storageClassName: local-path` and request `64Gi` storage for each HanaDB pod. Update the storage class if your cluster uses a different provisioner. + ## Check Available HanaDBVersion ```bash kubectl get hanadbversions ``` -## Create a HanaDB Database +## Create a HanaDB Cluster ```yaml apiVersion: kubedb.com/v1alpha2 @@ -51,7 +53,7 @@ metadata: namespace: demo spec: version: "2.0.82" - replicas: 2 + replicas: 3 storageType: "Durable" topology: mode: SystemReplication @@ -71,7 +73,7 @@ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}} kubectl get hanadb -n demo hana-cluster -w ``` -## Verify HanaDB Database +## Verify the Cluster ```bash kubectl get hanadb -n demo @@ -85,4 +87,4 @@ When `status.phase` becomes `Ready`, the HanaDB deployment is ready for applicat ```bash kubectl delete hanadb -n demo hana-cluster kubectl delete ns demo -``` \ No newline at end of file +``` diff --git a/docs/guides/hanadb/quickstart/rbac.md b/docs/guides/hanadb/quickstart/rbac.md index 18a3d2a3e..03274f49f 100644 --- a/docs/guides/hanadb/quickstart/rbac.md +++ b/docs/guides/hanadb/quickstart/rbac.md @@ -14,23 +14,27 @@ section_menu_id: guides # RBAC Permissions for HanaDB -When RBAC is enabled in your cluster, KubeDB automatically creates the necessary Role, ServiceAccount, and RoleBinding for each HanaDB instance. This tutorial explains what permissions are granted and how to verify them. +When RBAC is enabled in your cluster, KubeDB automatically creates the RBAC resources required by each HanaDB instance. This tutorial explains what permissions are granted and how to verify them. -Here is the list of additional permissions required by the PetSet of HanaDB: +The HanaDB pods require the following namespace-scoped permissions: -| Kubernetes Resource | Resource Names | Permission required | -|---------------------|-------------------|---------------------| -| petsets | `{hanadb-name}` | get | -| pods | | list, patch | -| pods/exec | | create | -| hanadbs | | get | -| configmaps | `{hanadb-name}` | get, update, create | +| Kubernetes Resource | Permission required | +|---------------------|----------------------------------| +| pods | `*` | +| pods/exec | `create` | +| hanadbs | `get`, `list`, `watch`, `patch` | +| hanadbs/status | `patch` | +| secrets | `get`, `list`, `create`, `update` | +| petsets | `get`, `list`, `watch` | +| configmaps | `create`, `get`, `update` | + +They also require cluster-scoped read access to `hanadbversions` and `hanadbs`. ## Before You Begin -- At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). +- Prepare a Kubernetes cluster and configure `kubectl` to communicate with it. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/). -- Now, install KubeDB cli on your workstation and KubeDB operator in your cluster following the steps [here](/docs/setup/README.md). +- Install the KubeDB CLI on your workstation and the KubeDB operator in your cluster by following the steps [here](/docs/setup/README.md). - To keep things isolated, this tutorial uses a separate namespace called `demo` throughout this tutorial. @@ -41,7 +45,7 @@ namespace/demo created ## Create a HanaDB Database -Below is the HanaDB object created in this tutorial. +The following manifest creates the HanaDB instance used in this tutorial. ```yaml apiVersion: kubedb.com/v1alpha2 @@ -54,23 +58,23 @@ spec: replicas: 1 storageType: Durable storage: - storageClassName: "standard" + storageClassName: local-path accessModes: - ReadWriteOnce resources: requests: - storage: 10Gi + storage: 64Gi deletionPolicy: Delete ``` -Create the above HanaDB object: +Create the HanaDB object: ```bash $ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/quickstart/quick-hanadb.yaml hanadb.kubedb.com/quick-hanadb created ``` -When this HanaDB object is created, KubeDB operator creates Role, ServiceAccount and RoleBinding with the matching HanaDB name. +When the HanaDB object is created, the KubeDB operator creates a `Role`, `ServiceAccount`, `RoleBinding`, `ClusterRole`, and `ClusterRoleBinding` with the matching HanaDB name. ### Role @@ -88,35 +92,49 @@ metadata: namespace: demo rules: - apiGroups: - - apps - resourceNames: - - quick-hanadb + - "" resources: - - petsets + - pods verbs: - - get + - "*" +- apiGroups: + - "" + resources: + - pods/exec + verbs: + - create - apiGroups: - kubedb.com - resourceNames: - - quick-hanadb resources: - hanadbs verbs: - get + - list + - watch + - patch - apiGroups: - - "" + - kubedb.com resources: - - pods + - hanadbs/status verbs: - - get - - list - patch - apiGroups: - "" resources: - - pods/exec + - secrets verbs: + - get + - list - create + - update +- apiGroups: + - apps.k8s.appscode.com + resources: + - petsets + verbs: + - get + - list + - watch - apiGroups: - "" resources: @@ -167,13 +185,65 @@ subjects: namespace: demo ``` +### ClusterRole + +```bash +$ kubectl get clusterrole quick-hanadb -o yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: quick-hanadb +rules: +- apiGroups: + - catalog.kubedb.com + resources: + - hanadbversions + verbs: + - get + - list + - watch +- apiGroups: + - kubedb.com + resources: + - hanadbs + verbs: + - get + - list + - watch +``` + +### ClusterRoleBinding + +```bash +$ kubectl get clusterrolebinding quick-hanadb -o yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + app.kubernetes.io/component: database + app.kubernetes.io/instance: quick-hanadb + app.kubernetes.io/managed-by: kubedb.com + app.kubernetes.io/name: hanadbs.kubedb.com + name: quick-hanadb +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: quick-hanadb +subjects: +- kind: ServiceAccount + name: quick-hanadb + namespace: demo +``` + ## Cleaning up -To cleanup the Kubernetes resources created by this tutorial, run: +To clean up the Kubernetes resources created by this tutorial, run: ```bash kubectl patch -n demo hanadb/quick-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" kubectl delete -n demo hanadb/quick-hanadb +kubectl delete clusterrolebinding quick-hanadb +kubectl delete clusterrole quick-hanadb kubectl delete ns demo ``` From 57b656385a68d85d9916954651d37c3733a4a2c0 Mon Sep 17 00:00:00 2001 From: ZobayerAbedin Date: Tue, 5 May 2026 14:17:57 +0600 Subject: [PATCH 5/5] Update clustering secion, CR names Signed-off-by: ZobayerAbedin --- .../hanadb/clustering/standalone.yaml | 2 +- .../hanadb/clustering/system-replication.yaml | 2 +- .../hanadb/configuration/custom-hanadb.yaml | 2 +- .../hanadb/custom-rbac/hanadb-custom-db.yaml | 2 +- .../monitoring/builtin-prom-hanadb.yaml | 2 +- .../hanadb/monitoring/coreos-prom-hanadb.yaml | 2 +- .../private-registry/pvt-reg-hanadb.yaml | 2 +- .../hanadb/quickstart/quick-hanadb.yaml | 2 +- .../hanadb/quickstart/system-replication.yaml | 2 +- docs/guides/hanadb/README.md | 2 +- docs/guides/hanadb/clustering/standalone.md | 12 ++-- .../hanadb/clustering/system-replication.md | 69 ++++++++++--------- docs/guides/hanadb/concepts/appbinding.md | 10 +-- docs/guides/hanadb/concepts/hanadb.md | 2 +- .../hanadb/configuration/using-config-file.md | 22 +++--- .../hanadb/custom-rbac/using-custom-rbac.md | 16 ++--- docs/guides/hanadb/monitoring/overview.md | 2 +- .../monitoring/using-builtin-prometheus.md | 32 ++++----- .../monitoring/using-prometheus-operator.md | 28 ++++---- .../using-private-registry.md | 14 ++-- docs/guides/hanadb/quickstart/quickstart.md | 8 +-- docs/guides/hanadb/quickstart/rbac.md | 48 ++++++------- 22 files changed, 142 insertions(+), 141 deletions(-) diff --git a/docs/examples/hanadb/clustering/standalone.yaml b/docs/examples/hanadb/clustering/standalone.yaml index 6654601c1..7fdb98950 100644 --- a/docs/examples/hanadb/clustering/standalone.yaml +++ b/docs/examples/hanadb/clustering/standalone.yaml @@ -1,7 +1,7 @@ apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: hana-standalone + name: hanadb-standalone namespace: demo spec: version: "2.0.82" diff --git a/docs/examples/hanadb/clustering/system-replication.yaml b/docs/examples/hanadb/clustering/system-replication.yaml index ad5f5c657..93303ff42 100644 --- a/docs/examples/hanadb/clustering/system-replication.yaml +++ b/docs/examples/hanadb/clustering/system-replication.yaml @@ -1,7 +1,7 @@ apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: hana-cluster + name: hanadb-cluster namespace: demo spec: version: "2.0.82" diff --git a/docs/examples/hanadb/configuration/custom-hanadb.yaml b/docs/examples/hanadb/configuration/custom-hanadb.yaml index 2bff92e4b..c4631234e 100644 --- a/docs/examples/hanadb/configuration/custom-hanadb.yaml +++ b/docs/examples/hanadb/configuration/custom-hanadb.yaml @@ -1,7 +1,7 @@ apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: custom-hanadb + name: hanadb-custom-config namespace: demo spec: version: "2.0.82" diff --git a/docs/examples/hanadb/custom-rbac/hanadb-custom-db.yaml b/docs/examples/hanadb/custom-rbac/hanadb-custom-db.yaml index 592eaacac..4e3806670 100644 --- a/docs/examples/hanadb/custom-rbac/hanadb-custom-db.yaml +++ b/docs/examples/hanadb/custom-rbac/hanadb-custom-db.yaml @@ -1,7 +1,7 @@ apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: quick-hanadb + name: hanadb-custom-rbac namespace: demo spec: version: "2.0.82" diff --git a/docs/examples/hanadb/monitoring/builtin-prom-hanadb.yaml b/docs/examples/hanadb/monitoring/builtin-prom-hanadb.yaml index f9f5a9512..e065c3dec 100644 --- a/docs/examples/hanadb/monitoring/builtin-prom-hanadb.yaml +++ b/docs/examples/hanadb/monitoring/builtin-prom-hanadb.yaml @@ -1,7 +1,7 @@ apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: builtin-prom-hanadb + name: hanadb-builtin-prometheus namespace: demo spec: version: "2.0.82" diff --git a/docs/examples/hanadb/monitoring/coreos-prom-hanadb.yaml b/docs/examples/hanadb/monitoring/coreos-prom-hanadb.yaml index 218542f04..2f7318515 100644 --- a/docs/examples/hanadb/monitoring/coreos-prom-hanadb.yaml +++ b/docs/examples/hanadb/monitoring/coreos-prom-hanadb.yaml @@ -1,7 +1,7 @@ apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: coreos-prom-hanadb + name: hanadb-prometheus-operator namespace: demo spec: version: "2.0.82" diff --git a/docs/examples/hanadb/private-registry/pvt-reg-hanadb.yaml b/docs/examples/hanadb/private-registry/pvt-reg-hanadb.yaml index 6f18833dd..ce2ca5772 100644 --- a/docs/examples/hanadb/private-registry/pvt-reg-hanadb.yaml +++ b/docs/examples/hanadb/private-registry/pvt-reg-hanadb.yaml @@ -1,7 +1,7 @@ apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: pvt-reg-hanadb + name: hanadb-private-registry namespace: demo spec: version: "2.0.82-private" diff --git a/docs/examples/hanadb/quickstart/quick-hanadb.yaml b/docs/examples/hanadb/quickstart/quick-hanadb.yaml index 31224b9c4..2c9807627 100644 --- a/docs/examples/hanadb/quickstart/quick-hanadb.yaml +++ b/docs/examples/hanadb/quickstart/quick-hanadb.yaml @@ -1,7 +1,7 @@ apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: quick-hanadb + name: hanadb-quickstart namespace: demo spec: version: "2.0.82" diff --git a/docs/examples/hanadb/quickstart/system-replication.yaml b/docs/examples/hanadb/quickstart/system-replication.yaml index b15820948..3396eb92b 100644 --- a/docs/examples/hanadb/quickstart/system-replication.yaml +++ b/docs/examples/hanadb/quickstart/system-replication.yaml @@ -1,7 +1,7 @@ apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: hana-cluster + name: hanadb-cluster namespace: demo spec: version: "2.0.82" diff --git a/docs/guides/hanadb/README.md b/docs/guides/hanadb/README.md index cc95347c7..89e253376 100644 --- a/docs/guides/hanadb/README.md +++ b/docs/guides/hanadb/README.md @@ -43,7 +43,7 @@ KubeDB supports the following SAP HANA version: apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: hana-cluster + name: hanadb-cluster namespace: demo spec: version: "2.0.82" diff --git a/docs/guides/hanadb/clustering/standalone.md b/docs/guides/hanadb/clustering/standalone.md index ae2e7a93c..fd943b28d 100644 --- a/docs/guides/hanadb/clustering/standalone.md +++ b/docs/guides/hanadb/clustering/standalone.md @@ -37,7 +37,7 @@ The following manifest creates a standalone HanaDB instance. If `spec.topology` apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: hana-standalone + name: hanadb-standalone namespace: demo spec: version: "2.0.82" @@ -57,20 +57,20 @@ Create the database: ```bash $ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/clustering/standalone.yaml -hanadb.kubedb.com/hana-standalone created +hanadb.kubedb.com/hanadb-standalone created ``` Wait for the database to become ready: ```bash -$ kubectl get hanadb -n demo hana-standalone -NAME VERSION STATUS AGE -hana-standalone 2.0.82 Ready 5m +$ kubectl get hanadb -n demo hanadb-standalone +NAME VERSION STATUS AGE +hanadb-standalone 2.0.82 Ready 5m ``` ## Cleaning up ```bash -kubectl delete hanadb -n demo hana-standalone +kubectl delete hanadb -n demo hanadb-standalone kubectl delete ns demo ``` diff --git a/docs/guides/hanadb/clustering/system-replication.md b/docs/guides/hanadb/clustering/system-replication.md index f9fe87241..3200d838c 100644 --- a/docs/guides/hanadb/clustering/system-replication.md +++ b/docs/guides/hanadb/clustering/system-replication.md @@ -63,12 +63,13 @@ System replication behavior is controlled by two fields under `spec.topology.sys ### Operation Mode `operationMode` controls how the secondary receives and replays data. +For every system replication cluster, KubeDB creates the primary service and governing headless service. The operation mode determines whether KubeDB also creates a secondary read service. -| Mode | Read access | Service behavior | -|------|-------------|------------------| -| `logreplay` | Disabled | KubeDB creates the primary service and governing headless service. This is the default when `operationMode` is omitted. | -| `delta_datashipping` | Disabled | KubeDB creates the primary service and governing headless service. | -| `logreplay_readaccess` | Enabled | KubeDB creates the primary service, secondary service, and governing headless service. | +| Mode | Read access | Secondary service | +|------|-------------|-------------------| +| `logreplay` | Disabled | Not created. This is the default when `operationMode` is omitted. | +| `delta_datashipping` | Disabled | Not created. | +| `logreplay_readaccess` | Enabled | Created as `secondary-`. | Read access is enabled only by setting: @@ -102,7 +103,7 @@ topology: apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: hana-cluster + name: hanadb-cluster namespace: demo spec: version: "2.0.82" @@ -127,15 +128,15 @@ Create the database: ```bash $ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/clustering/system-replication.yaml -hanadb.kubedb.com/hana-cluster created +hanadb.kubedb.com/hanadb-cluster created ``` Wait for the cluster to become ready: ```bash -$ kubectl get hanadb -n demo hana-cluster -NAME VERSION STATUS AGE -hana-cluster 2.0.82 Ready 8m +$ kubectl get hanadb -n demo hanadb-cluster +NAME VERSION STATUS AGE +hanadb-cluster 2.0.82 Ready 8m ``` ## Verify System Replication Resources @@ -143,41 +144,41 @@ hana-cluster 2.0.82 Ready 8m Check the pods. Each HanaDB pod should have the database container and the coordinator sidecar running. ```bash -$ kubectl get pods -n demo --selector="app.kubernetes.io/instance=hana-cluster" -NAME READY STATUS RESTARTS AGE -hana-cluster-0 2/2 Running 0 8m -hana-cluster-1 2/2 Running 0 8m -hana-cluster-2 2/2 Running 0 8m +$ kubectl get pods -n demo --selector="app.kubernetes.io/instance=hanadb-cluster" +NAME READY STATUS RESTARTS AGE +hanadb-cluster-0 2/2 Running 0 8m +hanadb-cluster-1 2/2 Running 0 8m +hanadb-cluster-2 2/2 Running 0 8m ``` Check the services created for the cluster: ```bash -$ kubectl get svc -n demo --selector="app.kubernetes.io/instance=hana-cluster" -NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE -hana-cluster ClusterIP 10.96.100.10 39017/TCP 8m -secondary-hana-cluster ClusterIP 10.96.100.11 39017/TCP 8m -hana-cluster-pods ClusterIP None 39001/TCP,39017/TCP 8m +$ kubectl get svc -n demo --selector="app.kubernetes.io/instance=hanadb-cluster" +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +hanadb-cluster ClusterIP 10.96.100.10 39017/TCP 8m +secondary-hanadb-cluster ClusterIP 10.96.100.11 39017/TCP 8m +hanadb-cluster-pods ClusterIP None 39001/TCP,39017/TCP 8m ``` The services have the following roles: | Service | Use | |---------|-----| -| `hana-cluster` | Primary service. Applications should use this service for write traffic. | -| `secondary-hana-cluster` | Secondary service. Created when `operationMode` is `logreplay_readaccess`; applications can use it for read traffic. | -| `hana-cluster-pods` | Headless governing service used for pod DNS and internal cluster coordination. | +| `hanadb-cluster` | Primary service. Applications should use this service for write traffic. | +| `secondary-hanadb-cluster` | Secondary service. Created when `operationMode` is `logreplay_readaccess`; applications can use it for read traffic. | +| `hanadb-cluster-pods` | Headless governing service used for pod DNS and internal cluster coordination. | -If you use `operationMode: logreplay` or `operationMode: delta_datashipping`, the `secondary-hana-cluster` service is not created because secondary read access is disabled. +If you use `operationMode: logreplay` or `operationMode: delta_datashipping`, the `secondary-hanadb-cluster` service is not created because secondary read access is disabled. You can also inspect the endpoints to see which pods each service currently selects: ```bash -$ kubectl get endpoints -n demo hana-cluster secondary-hana-cluster hana-cluster-pods -NAME ENDPOINTS AGE -hana-cluster 10.244.0.12:39017 8m -secondary-hana-cluster 10.244.0.13:39017,10.244.0.14:39017 8m -hana-cluster-pods 10.244.0.12:39017,10.244.0.13:39017 + 4 more 8m +$ kubectl get endpoints -n demo hanadb-cluster secondary-hanadb-cluster hanadb-cluster-pods +NAME ENDPOINTS AGE +hanadb-cluster 10.244.0.12:39017 8m +secondary-hanadb-cluster 10.244.0.13:39017,10.244.0.14:39017 8m +hanadb-cluster-pods 10.244.0.12:39017,10.244.0.13:39017 + 4 more 8m ``` ## Verify Replication Status @@ -187,13 +188,13 @@ KubeDB checks SAP HANA system replication by querying `SYS.M_SERVICE_REPLICATION First, read the generated SYSTEM user password: ```bash -$ export HANA_PASSWORD=$(kubectl get secret -n demo hana-cluster-auth -o jsonpath='{.data.password}' | base64 -d) +$ export HANA_PASSWORD=$(kubectl get secret -n demo hanadb-cluster-auth -o jsonpath='{.data.password}' | base64 -d) ``` Then query the replication status from the primary pod: ```bash -$ kubectl exec -it -n demo hana-cluster-0 -c hanadb -- hdbsql \ +$ kubectl exec -it -n demo hanadb-cluster-0 -c hanadb -- hdbsql \ -u SYSTEM -p "$HANA_PASSWORD" -d SYSTEMDB \ "SELECT REPLICATION_STATUS, REPLICATION_STATUS_DETAILS, (LAST_LOG_POSITION - REPLAYED_LOG_POSITION) AS REPLAY_BACKLOG FROM SYS.M_SERVICE_REPLICATION" REPLICATION_STATUS REPLICATION_STATUS_DETAILS REPLAY_BACKLOG @@ -208,18 +209,18 @@ The cluster is healthy when every secondary reports `ACTIVE` and the replay back Applications should connect to the primary service for writes: ```bash -hana-cluster.demo.svc:39017 +hanadb-cluster.demo.svc:39017 ``` If you selected `operationMode: logreplay_readaccess`, read-only clients can connect to the secondary service: ```bash -secondary-hana-cluster.demo.svc:39017 +secondary-hanadb-cluster.demo.svc:39017 ``` ## Cleaning up ```bash -kubectl delete hanadb -n demo hana-cluster +kubectl delete hanadb -n demo hanadb-cluster kubectl delete ns demo ``` diff --git a/docs/guides/hanadb/concepts/appbinding.md b/docs/guides/hanadb/concepts/appbinding.md index 49ed486c1..a16aea7cb 100644 --- a/docs/guides/hanadb/concepts/appbinding.md +++ b/docs/guides/hanadb/concepts/appbinding.md @@ -28,27 +28,27 @@ An `AppBinding` object created by KubeDB for a HanaDB instance looks like this: apiVersion: appcatalog.appscode.com/v1alpha1 kind: AppBinding metadata: - name: hana-cluster + name: hanadb-cluster namespace: demo labels: app.kubernetes.io/component: database - app.kubernetes.io/instance: hana-cluster + app.kubernetes.io/instance: hanadb-cluster app.kubernetes.io/managed-by: kubedb.com app.kubernetes.io/name: hanadbs.kubedb.com spec: appRef: apiGroup: kubedb.com kind: HanaDB - name: hana-cluster + name: hanadb-cluster namespace: demo clientConfig: service: - name: hana-cluster + name: hanadb-cluster path: / port: 39017 scheme: tcp secret: - name: hana-cluster-auth + name: hanadb-cluster-auth type: kubedb.com/hanadb version: "2.0.82" ``` diff --git a/docs/guides/hanadb/concepts/hanadb.md b/docs/guides/hanadb/concepts/hanadb.md index 80098bca2..f312dee78 100644 --- a/docs/guides/hanadb/concepts/hanadb.md +++ b/docs/guides/hanadb/concepts/hanadb.md @@ -24,7 +24,7 @@ section_menu_id: guides apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: hana-cluster + name: hanadb-cluster namespace: demo spec: version: "2.0.82" diff --git a/docs/guides/hanadb/configuration/using-config-file.md b/docs/guides/hanadb/configuration/using-config-file.md index 01b0af8c0..ec9f4bf9e 100644 --- a/docs/guides/hanadb/configuration/using-config-file.md +++ b/docs/guides/hanadb/configuration/using-config-file.md @@ -79,7 +79,7 @@ Create a HanaDB object with `spec.configuration.secretName` set to the Secret na apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: custom-hanadb + name: hanadb-custom-config namespace: demo spec: version: "2.0.82" @@ -99,29 +99,29 @@ spec: ```bash $ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/configuration/custom-hanadb.yaml -hanadb.kubedb.com/custom-hanadb created +hanadb.kubedb.com/hanadb-custom-config created ``` Wait for the HanaDB instance to become ready. ```bash -$ kubectl get hanadb -n demo custom-hanadb -NAME VERSION STATUS AGE -custom-hanadb 2.0.82 Ready 5m +$ kubectl get hanadb -n demo hanadb-custom-config +NAME VERSION STATUS AGE +hanadb-custom-config 2.0.82 Ready 5m ``` Check that the pod is running: ```bash -$ kubectl get pod -n demo custom-hanadb-0 -NAME READY STATUS RESTARTS AGE -custom-hanadb-0 1/1 Running 0 5m +$ kubectl get pod -n demo hanadb-custom-config-0 +NAME READY STATUS RESTARTS AGE +hanadb-custom-config-0 1/1 Running 0 5m ``` Check whether the database started with the custom configuration by running `hdbsql` inside the pod. ```bash -$ kubectl exec -it -n demo custom-hanadb-0 -- hdbsql \ +$ kubectl exec -it -n demo hanadb-custom-config-0 -- hdbsql \ -u SYSTEM -p \ "SELECT KEY, VALUE FROM SYS.M_INIFILE_CONTENTS WHERE FILE_NAME = 'global.ini' AND KEY = 'global_allocation_limit'" KEY VALUE @@ -135,8 +135,8 @@ This guide covers initial custom configuration during provisioning. To clean up the Kubernetes resources created by this tutorial, run: ```bash -kubectl patch -n demo hanadb/custom-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" -kubectl delete -n demo hanadb/custom-hanadb +kubectl patch -n demo hanadb/hanadb-custom-config -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" +kubectl delete -n demo hanadb/hanadb-custom-config kubectl delete -n demo secret hanadb-configuration kubectl delete ns demo diff --git a/docs/guides/hanadb/custom-rbac/using-custom-rbac.md b/docs/guides/hanadb/custom-rbac/using-custom-rbac.md index c13fc0066..e514b8525 100644 --- a/docs/guides/hanadb/custom-rbac/using-custom-rbac.md +++ b/docs/guides/hanadb/custom-rbac/using-custom-rbac.md @@ -44,7 +44,7 @@ $ kubectl create serviceaccount -n demo my-custom-serviceaccount serviceaccount/my-custom-serviceaccount created ``` -Create a `Role` with the namespace-scoped permissions required by the HanaDB instance named `quick-hanadb`. +Create a `Role` with the namespace-scoped permissions required by the HanaDB instance named `hanadb-custom-rbac`. ```yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -181,7 +181,7 @@ Create a HanaDB object with `spec.podTemplate.spec.serviceAccountName` set to `m apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: quick-hanadb + name: hanadb-custom-rbac namespace: demo spec: version: "2.0.82" @@ -202,15 +202,15 @@ spec: ```bash $ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/custom-rbac/hanadb-custom-db.yaml -hanadb.kubedb.com/quick-hanadb created +hanadb.kubedb.com/hanadb-custom-rbac created ``` Check that the pod is running: ```bash -$ kubectl get pod -n demo quick-hanadb-0 -NAME READY STATUS RESTARTS AGE -quick-hanadb-0 1/1 Running 0 5m +$ kubectl get pod -n demo hanadb-custom-rbac-0 +NAME READY STATUS RESTARTS AGE +hanadb-custom-rbac-0 1/1 Running 0 5m ``` ## Cleaning up @@ -218,8 +218,8 @@ quick-hanadb-0 1/1 Running 0 5m To clean up the Kubernetes resources created by this tutorial, run: ```bash -kubectl patch -n demo hanadb/quick-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" -kubectl delete -n demo hanadb/quick-hanadb +kubectl patch -n demo hanadb/hanadb-custom-rbac -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" +kubectl delete -n demo hanadb/hanadb-custom-rbac kubectl delete -n demo serviceaccount my-custom-serviceaccount kubectl delete -n demo role my-custom-role diff --git a/docs/guides/hanadb/monitoring/overview.md b/docs/guides/hanadb/monitoring/overview.md index f8d838d9b..7f5fbdfbb 100644 --- a/docs/guides/hanadb/monitoring/overview.md +++ b/docs/guides/hanadb/monitoring/overview.md @@ -45,7 +45,7 @@ HanaDB monitoring is configured via `spec.monitor`. apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: coreos-prom-hanadb + name: hanadb-prometheus-operator namespace: demo spec: version: "2.0.82" diff --git a/docs/guides/hanadb/monitoring/using-builtin-prometheus.md b/docs/guides/hanadb/monitoring/using-builtin-prometheus.md index 34843a095..48f4a42d5 100644 --- a/docs/guides/hanadb/monitoring/using-builtin-prometheus.md +++ b/docs/guides/hanadb/monitoring/using-builtin-prometheus.md @@ -46,7 +46,7 @@ Deploy a HanaDB instance with monitoring enabled. The manifest is shown below. apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: builtin-prom-hanadb + name: hanadb-builtin-prometheus namespace: demo spec: version: "2.0.82" @@ -73,40 +73,40 @@ Create the HanaDB object: ```bash $ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/monitoring/builtin-prom-hanadb.yaml -hanadb.kubedb.com/builtin-prom-hanadb created +hanadb.kubedb.com/hanadb-builtin-prometheus created ``` Wait for the database to reach the `Ready` state. ```bash -$ kubectl get hanadb -n demo builtin-prom-hanadb -NAME VERSION STATUS AGE -builtin-prom-hanadb 2.0.82 Ready 2m +$ kubectl get hanadb -n demo hanadb-builtin-prometheus +NAME VERSION STATUS AGE +hanadb-builtin-prometheus 2.0.82 Ready 2m ``` KubeDB creates a separate stats service named `{hanadb-name}-stats` for metrics scraping. ```bash -$ kubectl get svc -n demo --selector="app.kubernetes.io/instance=builtin-prom-hanadb" -NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE -builtin-prom-hanadb ClusterIP 10.96.100.10 39017/TCP 2m -builtin-prom-hanadb-stats ClusterIP 10.96.100.11 9668/TCP 90s +$ kubectl get svc -n demo --selector="app.kubernetes.io/instance=hanadb-builtin-prometheus" +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +hanadb-builtin-prometheus ClusterIP 10.96.100.10 39017/TCP 2m +hanadb-builtin-prometheus-stats ClusterIP 10.96.100.11 9668/TCP 90s ``` -The `builtin-prom-hanadb-stats` service exposes the exporter endpoint. Describe the service: +The `hanadb-builtin-prometheus-stats` service exposes the exporter endpoint. Describe the service: ```bash -$ kubectl describe svc -n demo builtin-prom-hanadb-stats -Name: builtin-prom-hanadb-stats +$ kubectl describe svc -n demo hanadb-builtin-prometheus-stats +Name: hanadb-builtin-prometheus-stats Namespace: demo Labels: app.kubernetes.io/name=hanadbs.kubedb.com - app.kubernetes.io/instance=builtin-prom-hanadb + app.kubernetes.io/instance=hanadb-builtin-prometheus Annotations: monitoring.appscode.com/agent: prometheus.io/builtin prometheus.io/path: /metrics prometheus.io/port: 9668 prometheus.io/scheme: http prometheus.io/scrape: true -Selector: app.kubernetes.io/name=hanadbs.kubedb.com,app.kubernetes.io/instance=builtin-prom-hanadb +Selector: app.kubernetes.io/name=hanadbs.kubedb.com,app.kubernetes.io/instance=hanadb-builtin-prometheus Type: ClusterIP Port: metrics 9668/TCP ``` @@ -174,8 +174,8 @@ You should see the HanaDB metrics in the Prometheus dashboard under the `kubedb- To clean up the Kubernetes resources created by this tutorial, run: ```bash -kubectl patch -n demo hanadb/builtin-prom-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" -kubectl delete -n demo hanadb/builtin-prom-hanadb +kubectl patch -n demo hanadb/hanadb-builtin-prometheus -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" +kubectl delete -n demo hanadb/hanadb-builtin-prometheus kubectl delete ns demo kubectl delete ns monitoring diff --git a/docs/guides/hanadb/monitoring/using-prometheus-operator.md b/docs/guides/hanadb/monitoring/using-prometheus-operator.md index 60c49d611..44f9a0be1 100644 --- a/docs/guides/hanadb/monitoring/using-prometheus-operator.md +++ b/docs/guides/hanadb/monitoring/using-prometheus-operator.md @@ -46,7 +46,7 @@ Deploy a HanaDB instance with monitoring enabled using Prometheus Operator. apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: coreos-prom-hanadb + name: hanadb-prometheus-operator namespace: demo spec: version: "2.0.82" @@ -82,39 +82,39 @@ Create the HanaDB object: ```bash $ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/monitoring/coreos-prom-hanadb.yaml -hanadb.kubedb.com/coreos-prom-hanadb created +hanadb.kubedb.com/hanadb-prometheus-operator created ``` Wait for the database to reach the `Ready` state. ```bash -$ kubectl get hanadb -n demo coreos-prom-hanadb -NAME VERSION STATUS AGE -coreos-prom-hanadb 2.0.82 Ready 2m +$ kubectl get hanadb -n demo hanadb-prometheus-operator +NAME VERSION STATUS AGE +hanadb-prometheus-operator 2.0.82 Ready 2m ``` KubeDB will create a ServiceMonitor and stats service for this HanaDB instance. ```bash $ kubectl get servicemonitor -n demo -NAME AGE -coreos-prom-hanadb-stats 2m +NAME AGE +hanadb-prometheus-operator-stats 2m ``` Verify the `ServiceMonitor`: ```yaml -$ kubectl get servicemonitor -n demo coreos-prom-hanadb-stats -o yaml +$ kubectl get servicemonitor -n demo hanadb-prometheus-operator-stats -o yaml apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: labels: app.kubernetes.io/component: database - app.kubernetes.io/instance: coreos-prom-hanadb + app.kubernetes.io/instance: hanadb-prometheus-operator app.kubernetes.io/managed-by: kubedb.com app.kubernetes.io/name: hanadbs.kubedb.com release: prometheus - name: coreos-prom-hanadb-stats + name: hanadb-prometheus-operator-stats namespace: demo spec: endpoints: @@ -128,7 +128,7 @@ spec: - demo selector: matchLabels: - app.kubernetes.io/instance: coreos-prom-hanadb + app.kubernetes.io/instance: hanadb-prometheus-operator app.kubernetes.io/name: hanadbs.kubedb.com ``` @@ -142,15 +142,15 @@ To verify, port-forward the Prometheus service and visit `http://localhost:9090/ $ kubectl port-forward -n monitoring svc/prometheus-kube-prometheus-prometheus 9090:9090 ``` -You should see `demo/coreos-prom-hanadb-stats` target in an UP state. +You should see `demo/hanadb-prometheus-operator-stats` target in an UP state. ## Cleaning up To clean up the Kubernetes resources created by this tutorial, run: ```bash -kubectl patch -n demo hanadb/coreos-prom-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" -kubectl delete -n demo hanadb/coreos-prom-hanadb +kubectl patch -n demo hanadb/hanadb-prometheus-operator -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" +kubectl delete -n demo hanadb/hanadb-prometheus-operator kubectl delete ns demo kubectl delete ns monitoring diff --git a/docs/guides/hanadb/private-registry/using-private-registry.md b/docs/guides/hanadb/private-registry/using-private-registry.md index 6ef6ae85e..e7ac4e061 100644 --- a/docs/guides/hanadb/private-registry/using-private-registry.md +++ b/docs/guides/hanadb/private-registry/using-private-registry.md @@ -92,7 +92,7 @@ hanadbversion.catalog.kubedb.com/2.0.82-private created apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: pvt-reg-hanadb + name: hanadb-private-registry namespace: demo spec: version: "2.0.82-private" @@ -114,15 +114,15 @@ spec: ```bash $ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/private-registry/pvt-reg-hanadb.yaml -hanadb.kubedb.com/pvt-reg-hanadb created +hanadb.kubedb.com/hanadb-private-registry created ``` Check that the HanaDB pod is running: ```bash -$ kubectl get pods -n demo --selector="app.kubernetes.io/instance=pvt-reg-hanadb" -NAME READY STATUS RESTARTS AGE -pvt-reg-hanadb-0 1/1 Running 0 3m +$ kubectl get pods -n demo --selector="app.kubernetes.io/instance=hanadb-private-registry" +NAME READY STATUS RESTARTS AGE +hanadb-private-registry-0 1/1 Running 0 3m ``` ## Cleaning up @@ -130,8 +130,8 @@ pvt-reg-hanadb-0 1/1 Running 0 3m To clean up the Kubernetes resources created by this tutorial, run: ```bash -kubectl patch -n demo hanadb/pvt-reg-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" -kubectl delete -n demo hanadb/pvt-reg-hanadb +kubectl patch -n demo hanadb/hanadb-private-registry -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" +kubectl delete -n demo hanadb/hanadb-private-registry kubectl delete ns demo ``` diff --git a/docs/guides/hanadb/quickstart/quickstart.md b/docs/guides/hanadb/quickstart/quickstart.md index 8b70e20ba..bde1013cd 100644 --- a/docs/guides/hanadb/quickstart/quickstart.md +++ b/docs/guides/hanadb/quickstart/quickstart.md @@ -49,7 +49,7 @@ kubectl get hanadbversions apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: hana-cluster + name: hanadb-cluster namespace: demo spec: version: "2.0.82" @@ -70,14 +70,14 @@ spec: ```bash kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/quickstart/system-replication.yaml -kubectl get hanadb -n demo hana-cluster -w +kubectl get hanadb -n demo hanadb-cluster -w ``` ## Verify the Cluster ```bash kubectl get hanadb -n demo -kubectl describe hanadb -n demo hana-cluster +kubectl describe hanadb -n demo hanadb-cluster ``` When `status.phase` becomes `Ready`, the HanaDB deployment is ready for application traffic. @@ -85,6 +85,6 @@ When `status.phase` becomes `Ready`, the HanaDB deployment is ready for applicat ## Cleaning up ```bash -kubectl delete hanadb -n demo hana-cluster +kubectl delete hanadb -n demo hanadb-cluster kubectl delete ns demo ``` diff --git a/docs/guides/hanadb/quickstart/rbac.md b/docs/guides/hanadb/quickstart/rbac.md index 03274f49f..41d7d2357 100644 --- a/docs/guides/hanadb/quickstart/rbac.md +++ b/docs/guides/hanadb/quickstart/rbac.md @@ -51,7 +51,7 @@ The following manifest creates the HanaDB instance used in this tutorial. apiVersion: kubedb.com/v1alpha2 kind: HanaDB metadata: - name: quick-hanadb + name: hanadb-quickstart namespace: demo spec: version: "2.0.82" @@ -71,7 +71,7 @@ Create the HanaDB object: ```bash $ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/hanadb/quickstart/quick-hanadb.yaml -hanadb.kubedb.com/quick-hanadb created +hanadb.kubedb.com/hanadb-quickstart created ``` When the HanaDB object is created, the KubeDB operator creates a `Role`, `ServiceAccount`, `RoleBinding`, `ClusterRole`, and `ClusterRoleBinding` with the matching HanaDB name. @@ -79,16 +79,16 @@ When the HanaDB object is created, the KubeDB operator creates a `Role`, `Servic ### Role ```bash -$ kubectl get role -n demo quick-hanadb -o yaml +$ kubectl get role -n demo hanadb-quickstart -o yaml apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: labels: app.kubernetes.io/component: database - app.kubernetes.io/instance: quick-hanadb + app.kubernetes.io/instance: hanadb-quickstart app.kubernetes.io/managed-by: kubedb.com app.kubernetes.io/name: hanadbs.kubedb.com - name: quick-hanadb + name: hanadb-quickstart namespace: demo rules: - apiGroups: @@ -148,51 +148,51 @@ rules: ### ServiceAccount ```bash -$ kubectl get serviceaccount -n demo quick-hanadb -o yaml +$ kubectl get serviceaccount -n demo hanadb-quickstart -o yaml apiVersion: v1 kind: ServiceAccount metadata: labels: app.kubernetes.io/component: database - app.kubernetes.io/instance: quick-hanadb + app.kubernetes.io/instance: hanadb-quickstart app.kubernetes.io/managed-by: kubedb.com app.kubernetes.io/name: hanadbs.kubedb.com - name: quick-hanadb + name: hanadb-quickstart namespace: demo ``` ### RoleBinding ```bash -$ kubectl get rolebinding -n demo quick-hanadb -o yaml +$ kubectl get rolebinding -n demo hanadb-quickstart -o yaml apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: labels: app.kubernetes.io/component: database - app.kubernetes.io/instance: quick-hanadb + app.kubernetes.io/instance: hanadb-quickstart app.kubernetes.io/managed-by: kubedb.com app.kubernetes.io/name: hanadbs.kubedb.com - name: quick-hanadb + name: hanadb-quickstart namespace: demo roleRef: apiGroup: rbac.authorization.k8s.io kind: Role - name: quick-hanadb + name: hanadb-quickstart subjects: - kind: ServiceAccount - name: quick-hanadb + name: hanadb-quickstart namespace: demo ``` ### ClusterRole ```bash -$ kubectl get clusterrole quick-hanadb -o yaml +$ kubectl get clusterrole hanadb-quickstart -o yaml apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - name: quick-hanadb + name: hanadb-quickstart rules: - apiGroups: - catalog.kubedb.com @@ -215,23 +215,23 @@ rules: ### ClusterRoleBinding ```bash -$ kubectl get clusterrolebinding quick-hanadb -o yaml +$ kubectl get clusterrolebinding hanadb-quickstart -o yaml apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: labels: app.kubernetes.io/component: database - app.kubernetes.io/instance: quick-hanadb + app.kubernetes.io/instance: hanadb-quickstart app.kubernetes.io/managed-by: kubedb.com app.kubernetes.io/name: hanadbs.kubedb.com - name: quick-hanadb + name: hanadb-quickstart roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: quick-hanadb + name: hanadb-quickstart subjects: - kind: ServiceAccount - name: quick-hanadb + name: hanadb-quickstart namespace: demo ``` @@ -240,10 +240,10 @@ subjects: To clean up the Kubernetes resources created by this tutorial, run: ```bash -kubectl patch -n demo hanadb/quick-hanadb -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" -kubectl delete -n demo hanadb/quick-hanadb +kubectl patch -n demo hanadb/hanadb-quickstart -p '{"spec":{"deletionPolicy":"WipeOut"}}' --type="merge" +kubectl delete -n demo hanadb/hanadb-quickstart -kubectl delete clusterrolebinding quick-hanadb -kubectl delete clusterrole quick-hanadb +kubectl delete clusterrolebinding hanadb-quickstart +kubectl delete clusterrole hanadb-quickstart kubectl delete ns demo ```