Skip to content

The CrateDB Kubernetes Operator provides a convenient way to run CrateDB clusters inside Kubernetes.

License

Notifications You must be signed in to change notification settings

crate/crate-operator

Repository files navigation

Continuous Integration Docker Build Documentation Docker Hub

⚙️ CrateDB Kubernetes Operator

The CrateDB Kubernetes Operator provides convenient way to run CrateDB clusters inside Kubernetes. It is built on top of the Kopf: Kubernetes Operators Framework.

🗒️ Contents

🤹 Usage

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.

🎉 Features

  • "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 and Azure

💽 Installation

Installation with Helm

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.

Installation with kubectl

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.

💻 Development

Please refer to the Working on the operator section of the documentation.