下载Ansible部署文件:
# git clone https://github.com/lizhenliang/ansible-install-k8s
# cd ansible-install-k8s
下载软件包并解压/root目录:
云盘链接:https://pan.baidu.com/s/1nlnnHh4ufX5mDyHJ9goOSw 提取码:144p
# tar zxf binary_pkg.tar.gz
修改hosts文件,根据规划修改对应IP和名称。
# vi hosts
...
修改group_vars/all.yml文件,修改软件包目录和证书可信任IP。
# vim group_vars/all.yml
software_dir: '/root/binary_pkg'
...
cert_hosts:
k8s:
etcd:
单Master版:
# ansible-playbook -i hosts single-master-deploy.yml -uroot -k
多Master版:
# ansible-playbook -i hosts multi-master-deploy.yml -uroot -k
如果安装某个阶段失败,可针对性测试.
例如:只运行部署插件
# ansible-playbook -i hosts single-master-deploy.yml -uroot -k --tags addons
1)修改hosts,添加新节点ip
# vi hosts
2)执行部署
ansible-playbook -i hosts add-node.yml -uroot -k
3)在Master节点允许颁发证书并加入集群
kubectl get csr
kubectl certificate approve node-csr-xxx