我正在使用此模块 [1]:https ://github.com/kragniz/python-etcd3与 etcdv3 进行通信。我已经创建了所有必要的证书并测试了客户端与 curl 的安全连接。但是,尝试简单的 get 操作会失败。下面的代码片段和异常。
import etcd3
ca='/Users/PKI/etcd/ca.pem'
cert='/Users/PKI/etcd/client.pem'
key='/Users/PKI/etcd/client-key.pem'
etcd = etcd3.client(ca_cert=ca, cert_cert=cert, cert_key=key)
etcd.get('foo')
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "failed to connect to all addresses"
debug_error_string = "{"created":"@1594500226.366466000","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":3948,"referenced_errors":[{"created":"@1594500226.366461000","description":"failed to connect to all addresses","file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc","file_line":394,"grpc_status":14}]}"
>
> /usr/local/lib/python3.8/site-packages/etcd3/client.py(46)handler()
-> return f(*args, **kwargs)
我没有用 grpc 做太多事情,所以我不确定是否应该传递一些选项来初始化 etcd3 客户端。