Run Weaviate on Kubernetes
Now that you have a Kubernetes cluster, you can deploy Weaviate on it. This section will show you how to deploy Weaviate on Kubernetes using Helm.
Helm chart
As mentioned earlier, Helm is a package manager for Kubernetes. It uses a packaging format called charts.
A Helm chart is a collection of files that describe a set of Kubernetes resources. It is the equivalent of a package in other package managers, such as pip or npm.
Weaviate provides a Helm chart that you can use to deploy Weaviate on Kubernetes. So, we will use this Helm chart to deploy Weaviate on your Kubernetes cluster.
Deployment
First, add the Weaviate Helm repository to your Helm installation. This will make the Weaviate Helm chart available to you.
helm repo add weaviate https://weaviate.github.io/weaviate-helm
If you have previously added the weaviate
Helm repository, run this to update it to the latest version.
helm repo update weaviate
You should periodically update the Helm repositories to ensure that you have the latest information about available charts.
Next, generate a configuration file (values.yaml
) for the Weaviate Helm chart.
helm show values weaviate/weaviate > values.yaml
This command fetches the default values for the Weaviate Helm chart and saves them to a file named values.yaml
. You can now edit this file to customize the deployment configuration.
There are many settings you can configure here. It may be beneficial to explore them in the values.yaml
file, and review the relevant settings through the in-line comments, or in the official Weaviate documentation if you are curious.
For now, let's configure a couple of important settings, before deploying Weaviate.
Configuration
Before we go further, let's update the configuration file to:
- Enable the gRPC service
- Enable Cohere integrations
Open the values.yaml
file in a text editor, and update the following sections:
Enable the gRPC service
From helm chart version 17.0.0
, the gRPC service is enabled by default. If using older versions, you must enable it to use gRPC.
Check that the service's enabled
field is set to true
and the type
field is set to LoadBalancer
. This will expose the gRPC service, which will allow you to access it from outside the Kubernetes cluster so you can make of the gRPC API.
grpcService:
enabled: true # ⬅️ Make sure this is set to true
name: weaviate-grpc
ports:
- name: grpc
protocol: TCP
port: 50051
type: LoadBalancer # ⬅️ Set this to LoadBalancer (from NodePort) for this example
Enable Cohere integrations
text2vec-cohere:
enabled: true # ⬅️ Make sure this is set to true
# ... settings not shown ...
generative-cohere:
enabled: true # ⬅️ Make sure this is set to true
Save the file after making these changes. You are now ready to deploy Weaviate on your Kubernetes cluster.
Run Weaviate
Make sure your Kubernetes cluster is up and running (e.g. with minikube start
), and you have configured kubectl
to access it.
Let's first create a namespace for Weaviate:
kubectl create namespace weaviate
This will let us deploy Weaviate in a separate namespace. This is not mandatory, but we will do it here as it is good practice to allow better organization of resources.
Then, run the following command:
helm upgrade --install \
"weaviate" \
weaviate/weaviate \
--namespace "weaviate" \
--values ./values.yaml
This command will deploy Weaviate in the weaviate
namespace of your Kubernetes cluster using the configuration specified in the values.yaml
file.
Now, if you run this:
kubectl get pods -n weaviate
You should see the Weaviate pods running in the weaviate
namespace.
Note that it may take a little bit of time for the pods to start up. You can check the status of the pods by running the kubectl get pods -n weaviate
command multiple times.
❯ kubectl get pods -n weaviate
NAME READY STATUS RESTARTS AGE
weaviate-0 0/1 Pending 0 15s
❯ kubectl get pods -n weaviate
NAME READY STATUS RESTARTS AGE
weaviate-0 1/1 Running 0 59s
Note how here, the weaviate-0
pod went from Pending
to Running
.
Congratulations! You have successfully deployed Weaviate on your local Kubernetes cluster. Next, let's confirm some basic interactions with Weaviate.
1.25
or higherTo upgrade to 1.25
or higher from a pre-1.25
version, you must delete the deployed StatefulSet
, update the helm chart to version 17.0.0
or higher, and re-deploy Weaviate.
See the 1.25 migration guide for Kubernetes for more details.
Questions and feedback
If you have any questions or feedback, let us know in the user forum.