On local environment, use spanner's docker emulator to create development tools.
If use minikube, run its docker in kubernetes environment, can start its container
minikube start
eval $(minikube docker-env)
docker run -p 9010:9010 -p 9020:9020 gcr.io/cloud-spanner-emulator/emulator
But can't create an instance via gcloud
command
gcloud spanner instances create test-env --config=emulator-config --description="Local dev instance" --nodes=1
It became pending.
When use an environment without minikube, I can start docker and create an instance
docker run -p 9010:9010 -p 9020:9020 gcr.io/cloud-spanner-emulator/emulator
gcloud spanner instances create test-env --config=emulator-config --description="Local dev instance" --nodes=1
gcloud spanner instances list
It seems can't run gcloud spanner
command under minikube's docker-env. Why?
Doing eval $(minikube docker-env)
configures environment to use minikube’s Docker daemon (https://minikube.sigs.k8s.io/docs/commands/docker-env/).
Thus, emulator is running "inside" the docker domain that is running "inside" the minikube cluster.
You can verify the same by sshing into the minikube cluster using ssh minikube
to see the list of running processes. You can then do a curl on http://localhost:9020/v1/projects/test-project/instances
, which should return a result immediately.