[配置]

[root@k8s-1 ~]# cat /proc/version 
Linux version 3.10.0-862.3.3.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) ) #1 SMP Fri Jun 15 04:15:27 UTC 2018
# 免密码设置
# Setup passphraseless ssh

# 所有节点创建/root/.ssh/目录
 mkdir /root/.ssh/
 cd /root/.ssh/

# 生成“公钥、私钥”
# ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
ssh-keygen -m PEM -b 5120 -t rsa -f ~/.ssh/id_rsa
 
# cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

# 复制 pub_keys 到所有节点
 ssh-copy-id -i ~/.ssh/id_rsa.pub root@k8s-2
 ssh-copy-id -i ~/.ssh/id_rsa.pub root@k8s-3

[测试]

[root@k8s-1 yaml]# ssh root@k8s-2
Last login: Wed Sep  5 18:06:56 2018 from k8s-1
[root@k8s-2 ~]# 
[root@k8s-2 ~]# exit
登出
Connection to k8s-2 closed.
[root@k8s-1 yaml]# ssh root@k8s-3
Last login: Wed Sep  5 18:07:01 2018 from k8s-1
[root@k8s-3 ~]# 
[root@k8s-3 ~]# exit
登出
Connection to k8s-3 closed.