如果副本不止一个,如何 ssh 一个 openshift3 pod?

How to ssh a openshift3 pod if replicas are more than one?

如果我的 Web 服务有多个副本,我如何通过 SSH 和调查单个 pod?

所以你必须列出 pods 并对你想要的 pod 名称执行 oc rsh :

$ oc project my-project
Now using project "my-project" on server "https://origin.my-company.com:8443".
$ oc get po 
my-pod-72-3eojp         1/1       Running     0          8d
my-pod-72-5bx0x         1/1       Running     0          8d
my-pod-72-8fgce         1/1       Running     0          8d
my-pod-72-c1twn         1/1       Running     6          8d
my-pod-72-kfcev         1/1       Running     1          8d
my-pod-72-lc39y         1/1       Running     10         8d
my-pod-72-s9664         1/1       Running     11         8d
my-pod-72-yt05k         1/1       Running     10         8d
#pick one and rsh into it:
$ oc rsh my-pod-72-s9664
sh-4.2$

现在您在复制服务的 pod 中打开了一个 shell。

希望对您有所帮助。