-2

我使用了这样的命令:

sshpass -p password ssh root@x.x.x.x 'date;kubectl get pod;date' 

我有:

Wed Sep 20 14:39:19 CST 2017
Unable to connect to the server: EOF
Wed Sep 20 14:39:20 CST 2017

如何解决这个问题?

所有 kubectl 命令在目标系统上运行良好。命令:

sshpass -p password ssh root@x.x.x.x 'kubectl'

也很好用:

 mynode /etc » sshpass -p password ssh -o StrictHostKeyChecking=no root@x.x.x.x "kubectl"                                                        
kubectl controls the Kubernetes cluster manager. 

Find more information at https://github.com/kubernetes/kubernetes.

Basic Commands (Beginner):
  create         Create a resource by filename or stdin
  expose         Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service
  run            Run a particular image on the cluster
  set            Set specific features on objects

Basic Commands (Intermediate):
  get            Display one or many resources
  explain        Documentation of resources
  edit           Edit a resource on the server
  delete         Delete resources by filenames, stdin, resources and names, or by resources and label selector
...
4

1 回答 1

0

你可以尝试运行这样的东西吗?

ssh master-01 -x 'kubectl --kubeconfig=/root/.kube/config get nodes'

在你的情况下是这样的:

 sshpass -p password  ssh master-01 -x 'kubectl --kubeconfig=/root/.kube/config get nodes'
于 2017-09-22T12:23:46.080 回答