根据 docs,我已经设置并部署了一个包含三个 CockroachDB pod 的 Kubernetes 状态集。我的最终目标是在不需要使用 kubectl 的情况下查询数据库。我的中间目标是查询数据库而不实际进入数据库 pod。
我将一个端口从一个 pod 转发到我的本地机器,并尝试连接:
$ kubectl port-forward cockroachdb-0 26257
Forwarding from 127.0.0.1:26257 -> 26257
Forwarding from [::1]:26257 -> 26257
# later, after attempting to connect:
Handling connection for 26257
E0607 16:32:20.047098 80112 portforward.go:329] an error occurred forwarding 26257 -> 26257: error forwarding port 26257 to pod cockroachdb-0_mc-red, uid : exit status 1: 2017/06/07 04:32:19 socat[40115] E connect(5, AF=2 127.0.0.1:26257, 16): Connection refused
$ cockroach node ls --insecure --host localhost --port 26257
Error: unable to connect or connection lost.
Please check the address and credentials such as certificates (if attempting to
communicate with a secure cluster).
rpc error: code = Internal desc = transport is closing
Failed running "node"
有人设法做到这一点吗?