Examples

Please be aware that the Operator is currently considered as a preview release, and therefore it should not be used in a production environment.

This section highlights a number of examples using the Operator. As a reminder, resource changes can be monitored in real time using the kubectl tool or with advanced TUI tools like k9s.

The examples leverage a public container image of ESDB, therefore, no pull secret is required.

Prerequisites

To get the best of this guide, a basic understanding of Kubernetes concepts is assumed.

Before using the examples, the following requirements should be met:

Deployment Scope

The examples in this guide show the Operator in one namespace (esdb-system) and ESDB resources in a different namespace (esdb).

Single Node Cluster

To deploy the cluster (named=esdb-sn-cluster):

kubectl apply -f config/examples/esdb-sn-cluster.yaml

To delete the cluster:

kubectl delete -f config/examples/esdb-sn-cluster.yaml

Multi Node Cluster

To deploy the cluster (named=esdb-cluster):

kubectl apply -f config/examples/esdb-cluster.yaml

To delete the cluster:

kubectl delete -f config/examples/esdb-cluster.yaml

Backup Cluster

To back up the cluster:

kubectl apply -f config/examples/esdb-cluster-backup.yaml

This will create a new EventStoreDBBackup resource called esdb-cluster-backup in the esdb namespace.

This example assumes that the Multi Node Cluster step has been run.

Restore Cluster

kubectl apply -f config/examples/esdb-cluster-from-backup.yaml
This example assumes that the following steps have been run:

- Multi Node Cluster
- Backup Cluster

This will create a new cluster called esdb-cluster-from-backup from the backup called esdb-cluster-backup.

Patching

Various parts of an EventStoreDB resource specification can be tailored, some examples are shown below:

Replicas

This example assumes that the Single Node Cluster has been run.

This bumps the number of nodes from 1 to 3:

kubectl -n esdb \
  patch eventstoredb esdb-sn-cluster \
  --type merge \
  --patch-file config/examples/patches/replicas.yaml

Node Resources

This increases the disk size used by each node in an ESDB cluster from 5GB to 10GB:

kubectl -n esdb \
  patch eventstoredb {esdb-cluster-name} \ (1)
  --type merge \
  --patch-file config/examples/patches/disk_resize.yaml
1 Replace {esdb-cluster-name} with the relevant ESDB cluster name.

This increases the CPU limits for each node in an ESDB cluster:

kubectl -n esdb \
  patch eventstoredb {esdb-cluster-name} \ (1)
  --type merge \
  --patch-file config/examples/patches/cpu_limits.yaml
1 Replace {esdb-cluster-name} with the relevant ESDB cluster name.

ESDB Image (Upgrades)

This YAML configuration example changes the container image used by each node in a cluster. This can be used to manage ESDB upgrades:

spec:
  image: eventstore/eventstore:{version} (1)
1 Replace {version} with a newer version of ESDB.

Assuming that the snippet above was saved to a file called upgrade.yaml, the following command can be used to apply it:

kubectl -n esdb \
  patch eventstoredb {esdb-cluster-name} \ (1)
  --type merge \
  --patch-file upgrade.yaml
1 Replace {esdb-cluster-name} with the relevant ESDB cluster name.