基于kubespray的k8s快速安装指南
1、下载kubespraywget https://github.com/kubernetes-sigs/kubespray/archive/v2.13.3.tar.gzmv v2.13.3.tar.gz kubespray_v2.13.3.tar.gztar zxvf kubespray_v2.13.3.tar.gz2、安装pip3yum install epel-release python3
·
1、下载kubespray
wget https://github.com/kubernetes-sigs/kubespray/archive/v2.13.3.tar.gz
mv v2.13.3.tar.gz kubespray_v2.13.3.tar.gz
tar zxvf kubespray_v2.13.3.tar.gz
2、安装pip3
yum install epel-release python36 python36-pip -y
3、安装依赖
cd kubespray-2.13.3/
pip3.6 install -r requirements.txt
4、更新配置
cp -rfp inventory/sample inventory/mycluster
declare -a IPS=(172.17.185.91 172.17.185.92 172.17.185.93 172.17.185.94)
CONFIG_FILE=inventory/mycluster/hosts.yaml python3.6 contrib/inventory_builder/inventory.py ${IPS[@]}
5、配置机器免登录
使用autossh.tar.gz 工具进行SSH免密配置.
注意:vim /etc/ssh/sshd_config里StrictModes no
6、验证免密
ansible all -i inventory/mycluster/hosts.yaml -m ping
7、替换官方镜像地址
修改文件:roles/download/defaults/main.yml
注意:由于使用https://storage.googleapis.com地址会被墙。
错误如下:(目前尚未解决)
TASK [download : download_file | Download item] ************************************************************************************************************************************************************
fatal: [node1 -> 172.17.185.91]: FAILED! => {"attempts": 4, "changed": false, "dest": "/tmp/releases/kubeadm-v1.17.9-amd64", "elapsed": 30, "msg": "Request failed: <urlopen error timed out>", "url": "https://storage.googleapis.com/kubernetes-release/release/v1.17.9/bin/linux/amd64/kubeadm"}
fatal: [node2 -> 172.17.185.92]: FAILED! => {"attempts": 4, "changed": false, "dest": "/tmp/releases/kubeadm-v1.17.9-amd64", "elapsed": 30, "msg": "Request failed: <urlopen error timed out>", "url": "https://storage.googleapis.com/kubernetes-release/release/v1.17.9/bin/linux/amd64/kubeadm"}
8、执行安装
ansible-playbook -i inventory/mycluster/hosts.yaml --become --become-user=root cluster.yml
更多推荐
已为社区贡献5条内容
所有评论(0)