The CrateDB Kubernetes Operator provides convenient way to run CrateDB clusters inside Kubernetes. It is built on top of the Kopf: Kubernetes Operators Framework.
A minimal custom resource for a 3 node CrateDB cluster may look like this:
dev-cluster.yaml:
apiVersion: cloud.crate.io/v1 kind: CrateDB metadata: name: my-cluster namespace: dev spec: cluster: imageRegistry: crate name: crate-dev version: 5.7.3 nodes: data: - name: hot replicas: 3 resources: limits: cpu: 4 memory: 4Gi disk: count: 1 size: 128GiB storageClass: default heapRatio: 0.5
$ kubectl --namespace dev create -f dev-cluster.yaml ... $ kubectl --namespace dev get cratedbs NAMESPACE NAME AGE dev my-cluster 36s
Please note that the minimum version of CrateDB that the operator supports is 4.5. Previous versions might work, but the operator will not attempt to set a license.
- "all equal nodes" cluster setup
- "master + data nodes" cluster setup
- safe scaling of clusters
- safe rolling version upgrades for clusters
- SSL for HTTP and PG connections via Let's Encrypt certificate
- custom node settings
- custom cluster settings
- custom storage classes
- region/zone awareness for AWS, Azure, GCP and STACKIT
- OpenShift support (Red Hat OpenShift Container Platform 4.x)
To be able to deploy the custom resource CrateDB to a Kubernetes cluster,
the API needs to be extended with a Custom Resource Definition (CRD).
It can be installed separately by installing the CRD Helm Chart or as a
dependency of the Operator Helm Chart.
helm repo add crate-operator https://crate.github.io/crate-operator helm install crate-operator crate-operator/crate-operator
To override the environment variables from values.yaml, please refer to the configuration documentation.
When installing on Red Hat OpenShift Container Platform, additional configuration is required, after adding the Helm repo:
helm install crate-operator crate-operator/crate-operator \ --set env.CRATEDB_OPERATOR_CLOUD_PROVIDER=openshift \ --set env.CRATEDB_OPERATOR_CRATE_CONTROL_IMAGE=your-registry/crate-control:latest \ --namespace crate-operator \ --create-namespace
Replace your-registry/crate-control:latest with the location of your built
crate-control sidecar image. See the OpenShift documentation for details.
To be able to deploy the custom resource CrateDB to a Kubernetes cluster,
the API needs to be extended with a Custom Resource Definition (CRD). The CRD
for CrateDB can be found in the deploy/ folder and can be applied
(assuming sufficient privileges).
$ kubectl apply -f deploy/crd.yaml customresourcedefinition.apiextensions.k8s.io/cratedbs.cloud.crate.io created
Once the CRD is installed, the operator itself can be deployed using a
Deployment in the crate-operator namespace.
$ kubectl create namespace crate-operator ... $ kubectl create -f deploy/rbac.yaml ... $ kubectl create -f deploy/deployment.yaml ...
Please refer to the configuration documentation for further details.
Please refer to the Working on the operator section of the documentation.