Closed liuqi-sun closed 2 years ago
It's not clear to me how you set up istio, but your dialing target, localhost:6666
, is likely to be incorrect.
See https://istio.io/latest/blog/2021/proxyless-grpc/#example for an example with istio.
Istid uses the default configuration, which I have not changed. https://github.com/istio/istio/blob/1.13.3/pilot/tools/debug/pilot_cli.go can successfully access localhost: 6666, and can obtain the XDS resources successfully. So I think localhost:6666 is true.
The client is failing because no LDS resource found for your target. So there must be some inconsistency between the client and server. Maybe try turning on the logs in the client: https://github.com/grpc/grpc-go#how-to-turn-on-logging And also check the xds server logs (from istio).
It's not clear to me how you set up istio, but your dialing target,
localhost:6666
, is likely to be incorrect.See https://istio.io/latest/blog/2021/proxyless-grpc/#example for an example with istio.
dialing target is GRPC Service? Not istiod? So localhost: 6666 is incorrect? My current requirement is to use XDS client to connect isTIOD and obtain XDS resources. Does GRPC library not support this scenario? Must A GRPC service be created to use the GRPC XDS feature? Localhost: 6666 is the IP and port of IStiod in my example.
The client is failing because no LDS resource found for your target. So there must be some inconsistency between the client and server. Maybe try turning on the logs in the client: https://github.com/grpc/grpc-go#how-to-turn-on-logging And also check the xds server logs (from istio).
https://github.com/istio/istio/blob/1.13.3/pilot/tools/debug/pilot_cli.go can successfully access localhost: 6666,The test results are as follows :
istiod logs are as follows:
The GRPC client test fails as follows:
istiod logs are as follows: istiod no logs
I do not understand that istiod project pilot_cli.go and GRPC project demo stream send() and receive() implementation is the same, why GRPC project demo accept failed? Send () and receive() are implemented in ads.pb.go.
When you use the xds
scheme (when dialing xds:///<target>
), the gRPC client will create another gRPC client to talk to istio, to fetch the resources (addresses of the backends etc).
What you want is a gRPC client directly to istio. So you shouldn't use the xds
scheme. Just make a dial to localhost:6666
, you should be able to make ADS streams.
Then there's the problem you mentioned in #5325. The xdsclient is internal only, so you will need to make your own ADS calls, and build the requests.
When you use the
xds
scheme (when dialingxds:///<target>
), the gRPC client will create another gRPC client to talk to istio, to fetch the resources (addresses of the backends etc).
Now I can understand that there are two clients, one connecting to the GRPC service in this example and one connecting to istiod, but the one connecting to IStiod uses localhost:6666. You can see the log, so far it is stream.recv () that always fails, I don't know why?
The server(grpc-go\examples\features\xds\server\main.go) in this example is as follows:
The client(grpc-go\examples\features\xds\client\main.go) in this example is as follows: ADS stream is closed with error: xds: stream.Recv() failed: rpc error: code = Unknown desc = missing parts in the service node "THIS_IS_THE_SNAPSHOT_ID_THAT_MATCHES_TO_XDS_CONTROLLER"
What you want is a gRPC client directly to istio. So you shouldn't use the
xds
scheme. Just make a dial tolocalhost:6666
, you should be able to make ADS streams.Then there's the problem you mentioned in #5325. The xdsclient is internal only, so you will need to make your own ADS calls, and build the requests.
How to create a client directly connected to IStio, the function of the client is under the internal package, do not know how to use, can you give an example?
How do I make my own ADS calls?
missing parts in the service node "THIS_IS_THE_SNAPSHOT_ID_THAT_MATCHES_TO_XDS_CONTROLLER"
The node id (you specified in the bootstrap file) is invalid
the function of the client is under the internal package, do not know how to use
The short answer is you cannot. As said https://github.com/grpc/grpc-go/issues/5100, the xdsclient is for gRPC internal use only. You can make a copy if you really want. But there's no API stability guaranteed.
Or, to make you own, ADS is just another RPC. You can dial to localhost:6666
, and start the RPC as shown here: https://github.com/grpc/grpc-go/blob/ee67b3d8e9521dd9f45b25ba1b09095e10b0db05/xds/internal/xdsclient/controller/version/v3/client.go#L77
Thank you very much for your answer
The node id (you specified in the bootstrap file) is invalid
It is true that the node ID is invalid. I found that the node ID has specifications by checking istiod source code. But XDS doesn't have a specification, which makes it easy to make mistakes like mine and waste time. Istiod specifications are as follows:
In addition, parsing errors occurred after the response was received, Is it GRPC XDS that does not support responses containing this field?
I found that GRPC ADS did not request the XDS server in the order of CDS, EDS, LDS and RDS. In the server and client, programs always watch Listener resources and always call LDS first
The parsing error is because the listener resources are parsed as server side listener, but seems you are expecting client side. The difference is if field APIListener
is set, and that's controlled by istio.
The order is always LDS, RDS, CDS, EDS. See https://github.com/grpc/proposal/blob/master/A27-xds-global-load-balancing.md
This issue is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed.
Hi,grpc-go/examples/features/xds/client fails to communicate with the ISTIOD.Error is as follows: case 1,
case 2,
istiod: version v1.13.3