grpc / grpc-java

The Java gRPC implementation. HTTP/2 based RPC
https://grpc.io/docs/languages/java/
Apache License 2.0
11.47k stars 3.85k forks source link

Failed to make the xds example with Istio #9640

Closed chickenlj closed 1 year ago

chickenlj commented 2 years ago

I have a problem running and understanding the xds example with Istio, it's mainly about how the initial Listener resources in istiod get created in advance for the grpc process to subscribe.

According to the README of the xds example, I assume I can run and experience it without needing to deploy it in pod, just run directly on my machine with the java command.

But I got errors for both the client and server, both told me listener resource cannot be found or listen type mismatch, sort of things like that.

For the client, I even mocked the service to consume by specifying one specific service already deployed in Istiod, something like xds:///app-300.demo.svc.cluster.local:8080, but the client can still not match the right resource for it to continue with the work.

So, essentially, my question is how could the management server be prepared in advance to cooperate with the proxyless grpc to work, is there a complete demo somewhere with the control plane also prepared for me to try?

YifeiZhuang commented 2 years ago

Does the istio server implement response to Ads streams: https://github.com/envoyproxy/data-plane-api/blob/main/envoy/service/discovery/v2/ads.proto#L29 for xDS discoeryRequest? It needs to configure/implement that in order for the gRPC process to subscribe. For example, this is a control plane for test purpose: https://github.com/grpc/grpc-java/blob/master/xds/src/test/java/io/grpc/xds/XdsTestControlPlaneService.java#L36. It generates responses for LDS/RDS/CDS/EDS resources. They are consumed by both the client and server.

chickenlj commented 2 years ago

Does the istio server implement response to Ads streams: https://github.com/envoyproxy/data-plane-api/blob/main/envoy/service/discovery/v2/ads.proto#L29 for xDS discoeryRequest? It needs to configure/implement that in order for the gRPC process to subscribe.

Yes, the client received LDS response from istiod, I guess it's because istiod responds with all the LDS resources for LDS subscription requsts with any parameter. The problem's that the client cannot find any listener that matches xds:///app-300.demo.svc.cluster.local:8080 after parsed the response. So my question is how should I create a new k8s service for it to create the right LDS resource to work with the grpc proxyless client?

chickenlj commented 2 years ago

Should any special annotations be set for the pod of a k8s service so Istiod would recognize that it's creating a grpc proxyless service and treat the resources created specially?

chickenlj commented 2 years ago

One error I got is

io.grpc.xds.ClientXdsClient$ResourceInvalidException: Listener 172.18.98.218_9100 with invalid traffic direction: OUTBOUND
sanjaypujare commented 2 years ago

@chickenlj I responded in a different issue https://github.com/grpc/grpc-java/issues/9639#issuecomment-1286224557 . Please take a look at the blog https://istio.io/latest/blog/2021/proxyless-grpc/ - it describes the steps needed to make Istio work with grpc-go. Same steps would be needed for grpc-java.

alesj commented 2 years ago

@chickenlj how does your bootstrap.json look like? I didn't get far with my setup ... see #9639 ... I get stuck at that log msg mentioned in the initial description.