Using the Cloud Spanner Addon

Cloud Spanner Addon

Cloud Spanner is a fully managed relational database. The Cloud Spanner addon provides a local emulator to test your local application without incurring the cost of an actual spanner instance.

Enable Cloud Spanner on minikube

To enable this addon, simply run:

  1. minikube addons enable cloud-spanner

Cloud Spanner Endpoints

Cloud Spanner provides two different ports, HTTP and GRPC. List Cloud Spanner emulator urls by running:

  1. minikube service cloud-spanner-emulator
  2. ####################Sample Output#########################
  3. |-----------|------------------------|-------------|---------------------------|
  4. | NAMESPACE | NAME | TARGET PORT | URL |
  5. |-----------|------------------------|-------------|---------------------------|
  6. | default | cloud-spanner-emulator | http/9020 | http://192.168.49.2:30233 |
  7. | | | grpc/9010 | http://192.168.49.2:30556 |
  8. |-----------|------------------------|-------------|---------------------------|
  9. [default cloud-spanner-emulator http/9020
  10. grpc/9010 http://192.168.49.2:30233
  11. http://192.168.49.2:30556]

Using Cloud Spanner within a cluster

Cloud Spanner emulator can be used via endpoint cloud-spanner-emulator:9020 for http clients and cloud-spanner-emulator:9010 for grpc clients respectively. If you’re using the standard client library for Cloud Spanner then set SPANNER_EMULATOR_HOST to the GRPC endpoint cloud-spanner-emulator:9010.

Testing installation

  1. kubectl get pods -n cloud-spanner-emulator

If everything went well, there should be no errors about Cloud Spanner’s installation in your minikube cluster.

Disable Cloud Spanner

To disable this addon, simply run:

  1. minikube addons disable cloud-spanner

Last modified July 7, 2023: Add addon readmes to website (cf976f6dd)