2017-06-19 97 views

回答

4

您可以将私钥复制到您的主虚拟机。然后,您可以使用ssh -i <path>/id_rsa [email protected]<agent private IP>指向k8s代理VM。

注意:代理的用户名和私钥与主虚拟机相同。

+1

谢谢!有效。你是生命的救星。 – codefx

5

您可以使用其中一个k8s主作为“堡垒主机”,并避免复制密钥。例如:

# In ~/.ssh/config 

Host agent1_private_ip agent2_private_ip .... 
    IdentityFile ~/.ssh/<your_k8s_cluster_key> 
    ProxyCommand ssh [email protected]_public_ip -W %h:%p 

现在只需ssh [email protected]_private_ip

查看更多在这里:http://blog.scottlowe.org/2015/11/21/using-ssh-bastion-host/


PS:这里的匆匆取回您的代理私有地址,在/etc/hosts格式:

kubectl get nodes -o json | jq -r '.items[].status.addresses[].address' | paste - -