//进入ansible目录
[root@delay ~]# cd /ect/ansible
//创建hosts-file配置文件、将节点ip写入保存
vim hosts-file
10.20.1.101
10.20.1.102
10.20.1.103
10.20.1.104
[root@delay ansible]# ./tools/yc-ssh-key-copy.sh ./hosts-file 登录名 密码
=======================================================================
hosts:
10.20.1.101
10.20.1.102
10.20.1.103
10.20.1.104
=======================================================================
=======================================================================
spawn ssh-copy-id root@10.20.1.101
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_ed25519.pub"
The authenticity of host '10.20.1.101 (10.20.1.101)' can't be established.
ECDSA key fingerprint is SHA256:skxh14y/SRdYj1Nn28ovq0r1uP0WBwsR2HIgWG9iGKs.
ECDSA key fingerprint is MD5:25:86:32:6d:eb:97:95:00:a1:10:db:58:25:5a:aa:84.
Are you sure you want to continue connecting (yes/no)? yes
installed
=======================================================================
spawn ssh-copy-id root@10.20.1.102
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_ed25519.pub"
The authenticity of host '10.20.1.102 (10.20.1.102)' can't be established.
ECDSA key fingerprint is SHA256:skxh14y/SRdYj1Nn28ovq0r1uP0WBwsR2HIgWG9iGKs.
ECDSA key fingerprint is MD5:25:86:32:6d:eb:97:95:00:a1:10:db:58:25:5a:aa:84.
Are you sure you want to continue connecting (yes/no)? yes
installed
..................后面输出省略
配置集群安装
[root@delay ansible]# cd /etc/ansible && cp example/hosts.multi-node hosts
//初始使用只修改ip为自己的即可 后面可调整其他详细参数
[root@delay ansible]# vim hosts
# 'etcd' cluster should have odd member(s) (1,3,5,...)
# variable 'NODE_NAME' is the distinct name of a member in 'etcd' cluster
[etcd]
10.20.1.101 NODE_NAME=etcd1
10.20.1.102 NODE_NAME=etcd2
10.20.1.103 NODE_NAME=etcd3
# master node(s)
[kube-master]
10.20.1.101
10.20.1.102
# work node(s)
[kube-node]
10.20.1.103
10.20.1.104