Please refer to Vespa quick start using Docker for more information on the basic single container example. Also see Vespa quick start using Kubernetes. Containers running Vespa should have minimum 4 GB memory available. Refer to Docker memory for details and troubleshooting.
See multinode-HA/gke for a more detailed Kubernetes example.
This example assumes that you already created a Google project, you have the gcloud command line and kubectl installed. If needed, please refer to GKE quickstart. Hints:
$ gcloud init
$ gcloud config set project <project ID here>
$ gcloud services enable containerregistry.googleapis.com
$ gcloud config set compute/region europe-west1
$ gcloud config set compute/zone europe-west1-b
The example below shows the steps to pop a GKE cluster and deploy a multinode setup on GKE.
Note: To extend this to multiple config servers, set publishNotReadyAddress: true on the service,
see troubleshooting.
Check-out the example repository:
$ git clone --depth 1 https://github.com/vespa-engine/sample-apps.git $ cd sample-apps/examples/operations/basic-search-on-gke
Create a GKE cluster : You can give arguments to this script to change, cluster name, number of nodes, nodes type, and region.
$ ./scripts/create_cluster.sh
Bootstrap config files: You can give arguments to this script to change number of containers and contents.
$ ./scripts/bootstrap.sh
Deploy the application:
$ ./scripts/deploy.sh
Feed data to the application:
$ ./scripts/feed.sh
Do a search:
$ HOSTNAME=$(kubectl get service/vespa -o jsonpath='{.status.loadBalancer.ingress[*].ip}')
$ PORT=$(kubectl get service/vespa -o jsonpath='{.spec.ports[?(@.name=="container")].port}')
$ curl -s "http://$HOSTNAME:$PORT/search/?yql=select+*+from+music+where+artist+contains+'eminem'" | \
python3 -m json.tool
Security notice This script is just an example, it'll expose the master node to internet. For production purpose you should disable it according to vespa security guidelines
Congratulations! You have now deployed and tested a Vespa application on a multinode cluster.
After you have finished testing the Vespa application, execute the following to delete the cluster:
Replace CLUSTER_NAME and ZONE with your own values. By default CLUSTER_NAME=vespa and ZONE=europe-west1-b
$ gcloud container clusters delete CLUSTER_NAME --zone ZONE
Remember to delete the disks used, too.