简体   繁体   English

Golang gRPC 客户端连接到 GKE

[英]Golang gRPC Client connecting to GKE

I am trying to deploy gRPC on GKE, and I followed this tutorial - https://cloud.google.com/solutions/exposing-grpc-services-on-gke-using-envoy-proxy我正在尝试在 GKE 上部署 gRPC,并按照本教程进行操作 - https://cloud.google.com/solutions/exposing-grpc-services-on-gke-using-envoy-proxy

I got through everything, but I do not seem to be able to run gRPC on golang, while I am able to run it on grpcurl.我完成了一切,但我似乎无法在 golang 上运行 gRPC,而我能够在 grpcurl 上运行它。

Anyone got any ideas?有人有什么想法吗?

I solved it after exploring the inner workings of grpcurl.在探索了 grpcurl 的内部工作原理后,我解决了它。 For anyone who might ever be stuck, here's the difference...对于任何可能被卡住的人来说,这就是区别......

// Not working...
conn, err = grpc.Dial(host, grpc.WithInsecure())

// Working...
var tlsConf tls.Config
tlsConf.InsecureSkipVerify = true
var creds = credentials.NewTLS(&tlsConf)
conn, err = grpc.Dial(host, grpc.WithTransportCredentials(creds))

Previously I used the flag grpc.WithInsecure() .以前我使用了标志grpc.WithInsecure() It didn't work, so exploring grpcurl, I found that they were using grpc.WithTransportCredentials() instead, with tls.Config , setting InsecureSkipVerify to true instead.它没有用,所以探索 grpcurl,我发现他们使用grpc.WithTransportCredentials()代替tls.Config ,将InsecureSkipVerify设置为 true 。 That turned out well.结果很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM