python-docs-samples
python-docs-samples copied to clipboard
gRPC on GKE tutorial: Python client (bookstore_client.py) cannot connect to the API backend in latest version of grc.io/endpointsv2/python-grpc-bookstore-server
In which file did you encounter the issue?
https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/endpoints/bookstore-grpc/bookstore_server.py
Did you change the file? If so, how?
Overrode the PORT env variable to set it to 8000. Changed https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/endpoints/kubernetes/grpc-bookstore.yaml
image: gcr.io/process-mining-gke/bookstore-grpc-server:latest env: - name: PORT value: "8000"
Describe the issue
This issue is with gRPC on GKE tutorial : https://cloud.google.com/endpoints/docs/grpc/get-started-kubernetes-engine
The python client (bookstore_client.py) can no longer connect to the API backend as the latest docker image build of the API backend (grc.io/endpointsv2/python-grpc-bookstore-server) ends up listening on the port specified by the PORT variable while the proxy (esp) forwards request to port 8000 as specified in the Kubernetes manifest file .
This is likely due to the changes made in https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/endpoints/bookstore-grpc/bookstore_server.py to make it work in Cloud Run which requires that the server listen on the port specified by the PORT environment.
@aruns99 Thanks for the report.
The change was introduced with https://github.com/GoogleCloudPlatform/python-docs-samples/pull/2764
It looks like the code uses 8000 if PORT
envvar is not set. Then I think everything should work, but I may miss something.
Adding the author of the PR here. @nareddyt WDYT?
Maybe in this file, we should use gcr.io/endpointsv2/python-grpc-bookstore-server:2
instead of gcr.io/endpointsv2/python-grpc-bookstore-server:1
?
For the ESP on GKE tutorial linked by the reported, it asks you to use gcr.io/endpointsv2/python-grpc-bookstore-server:1
.
But the issue description above uses gcr.io/process-mining-gke/bookstore-grpc-server:latest
. @aruns99, could you clarify where you got this image from? Is this your own backend image?
@tmatsuo tag 2 is for some serverless ESP tutorials (cloud run, cloud functions, etc.).
We kept tag 1 as is for the GKE tutorial. gcr.io/endpointsv2/python-grpc-bookstore-server:1
is the correct one for GCE/GKE.
@nareddyt I generated a new image from source which one would expect to work in either GKE or Cloud Run using gcloud builds submit --tag gcr.io/<PROJECT_ID>/python-grpc-bookstore-server
. The fix for GKE is to add PORT=8000 environment variable in endpoints/kubernetes/grpc-bookstore.yaml
I see, yes that is a good point. We plan on launching ESPv2 for GKE soon, so I'll update this doc and tutorials with the env var so it works with the latest code.
@tmatsuo can you assign this issue to me? Thanks
@nareddyt what's the latest on this issue?
I have not had a chance to work on it. Have not prioritized it because it's nice to have, but everything works as expected if you follow the documentation.
Okay, lowering priority
Hi @nareddyt, could you please provide an update on this issue? If you don't have time in the next few months to complete this, let us know what we have to do, and my team can make the changes. Thanks!
Sure, I can do this task this week. Thanks for the reminder!
friendly ping @nareddyt