🚧 NOTE: this is WIP and currently automates no operations besides Helm actions. We plan to convert this codebase to a Go-based Operator (from the current Helm-based implementation) and do not plan to support an upgrade path. 🚧
The Weaviate Operator is a Kubernetes Operator designed to automate the management of Weaviate Database Clusters.
Before getting started, make sure you have the following prerequisites:
- Have a kubernetes cluster.
- Ensure that your user is authorized with cluster-admin permissions.
If you want to deploy a local kubernetes cluster for local testing you can install kind:
brew install kind
And start a cluster with:
WORKERS=3
cat <<EOF > /tmp/kind-config.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: weaviate-k8s
nodes:
- role: control-plane
$([ "${WORKERS:-""}" != "" ] && for i in $(seq 1 $WORKERS); do echo "- role: worker"; done)
EOF
kind create cluster --wait 120s --name weaviate-k8s --config /tmp/kind-config.yaml
The Weaviate Operator wraps the weaviate-helm Helm charts, creating a CRD and CRs which allow passing specific values to configure the application.
There are multiple ways to run the weaviate-operator:
- The easiest way is to apply the one-single-command Manifest:
kubectl apply -f https://github.com/weaviate/weaviate-operator/releases/latest/download/operator.yamlOther alternative ways to install it is:
- Run the operator locally outside the cluster by executing the following command inside the
weaviate-operatorrepository:
make install run- Run the operator as a Deployment inside the cluster by executing the following command inside the
weaviate-operatorrepository:
make deployIn case the image is not available you can build it locally by running first:
make docker-buildThis will create locally the image semitechnologies/weaviate-operator.
If you have created your cluster via kind, you will have to make that image available inside the cluster:
kind load docker-image semitechnologies/weaviate-operator:0.0.2 --name weaviate-k8s- [NOT AVAILABLE YET] Deploy the operator with OLM (Operator Lifecycle Manager) in bundle format. First, install OLM using the
operator-sdk olm installcommand. Then, bundle your operator, build and push the bundle image, and finally run your bundle using theoperator-sdk run bundlecommand.
To create the Weaviate CR, apply the modified config/samples/apps_v1alpha1_weaviatecluster.yaml file:
kubectl apply -f config/samples/apps_v1alpha1_weaviatecluster.yaml -n weaviatemake sure to create the namespace weaviate (or any other namespace in which you want you Weaviate nodes to run) in advance:
kubectl create ns weaviateor simply create your own definition of the WeaviateCluster (based on the weaviate-helm values.yaml):
apiVersion: apps.weaviate.io/v1alpha1
kind: WeaviateCluster
metadata:
name: weaviatecluster-sample
namespace: weaviate
spec:
# Default values copied from <project_dir>/helm-charts/weaviate/values.yaml
debug: true
env:
CLUSTER_DATA_BIND_PORT: 7001
CLUSTER_GOSSIP_BIND_PORT: 7000
GOGC: 100
PROMETHEUS_MONITORING_ENABLED: false
PROMETHEUS_MONITORING_GROUP: false
QUERY_MAXIMUM_RESULTS: 100000
REINDEX_VECTOR_DIMENSIONS_AT_STARTUP: false
TRACK_VECTOR_DIMENSIONS: false
image:
tag: 1.26.1
replicas: 3
storage:
size: 32Gi
A new custom resource weaviatecluster will be now available:
kubectl get weaviatecluster -n weaviate
NAME AGE
weaviatecluster-sample 13s
The operator will create the statefulset for the CR based on the specified replica count and other configurations. Keep in mind that the resources will be created in the namespace you decide, in this example the weaviate namespace is used, but you can install it in any other namespace.
kubectl get statefulset weaviate -n weaviate
NAME READY AGE
weaviate 3/3 65sIf you encounter any issues, you can check the operator logs using the following command:
kubectl logs deployment.apps/weaviate-operator-controller-manager -n weaviate-operator-system -c managerYou can also check the CR status and events using the following command:
kubectl describe weaviateclusters.apps.weaviate.io -n weaviateTo clean up the weaviatecluster resources, delete the custom resource using the following command:
kubectl delete -f config/samples/apps_v1alpha1_weaviatecluster.yaml -n weaviateor deleting it directly:
kubectl delete weaviatecluster weaviatecluster-sample -n weaviateThen, uninstall the operator either using the single-command manifest:
kubectl delete -f https://github.com/weaviate/weaviate-operator/releases/latest/download/operator.yamlor using the repo's Makefile, by running the following command inside the weaviate-operator repo:
make undeployor simply stop the process if you started it via make install run.
The operator is based on the Weaviate Helm Chart. To update the Helm chart to the latest version, you can use the provided script:
./update-helm-chart.shTo update to a specific version of the Helm chart:
./update-helm-chart.sh 1.2.3After updating the Helm chart, you can generate the operator.yaml:
make generate-operator-yamlThe operator uses a single GitHub workflow with sequential jobs for the release process:
-
Release Job: Handles creating releases and updating the Helm chart
- Updates to the specified Helm chart version
- Generates the operator.yaml
- Creates a GitHub release with the operator.yaml attached
- For non-draft manual releases, creates and pushes a tag
-
Docker Build Job: Runs after the Release job completes
- Builds and pushes the Docker image with the appropriate version tag
- Only runs for non-draft releases
The workflow can be triggered in two ways:
-
Manual Trigger: Through the GitHub UI
- Go to Actions → Weaviate Operator Release → Run workflow
- Enter the version number and configure options:
- Helm chart version (defaults to latest)
- Draft mode (create as draft release)
-
Automatic Trigger: When a tag is pushed
- Create and push a tag:
git tag v1.2.3 && git push origin v1.2.3 - This will create a published release and build the Docker image
- Create and push a tag:
The Helm charts directory is excluded from git tracking to avoid committing large changes with each update. The charts are downloaded during the release process.