安装有docker镜像下载问题,需进一步处理
所有节点操作
#设置SELINUX
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
#配置主机解析/etc/hosts
172.19.32.2 master1
172.19.32.15 node1
172.19.32.16 node2
172.19.32.4 node3
#配置dns
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
master节点操作
#配置master节点SSH免密码登录node
ssh-keygen
cd ~/.ssh/
cat id_rsa.pub>> authorized_keys
#分发主节点里配置好的authorized_keys到各从节点
scp /root/.ssh/authorized_keys root@node1:~/.ssh/authorized_keys
scp /root/.ssh/authorized_keys root@node2:~/.ssh/authorized_keys
scp /root/.ssh/authorized_keys root@node3:~/.ssh/authorized_keys
#安装ansible
yum install -y epel-release ansible
#安装python3
yum -y install python36
python3 -V && pip3 -V
#下载kubespray,并安装依赖
wget https://github.com/kubernetes-sigs/kubespray/archive/v2.11.0.tar.gz
tar -zxvf v2.11.0.tar.gz
cd kubespray-2.11.0/
pip3 install -r requirements.txt
#错误解决:ModuleNotFoundError: No module named 'setuptools_rust'
python3 -m pip install --upgrade pip
#生成配置
cp -rfp inventory/sample inventory/mycluster
declare -a IPS=(172.19.32.15 172.19.32.16 172.19.32.4)
CONFIG_FILE=inventory/mycluster/hosts.yml python3 contrib/inventory_builder/inventory.py ${IPS[@]}
#安装集群
ansible-playbook -i inventory/mycluster/hosts.yml --become --become-user=root cluster.yml
pip3 install -r requirements.txt提示信息
[root@VM-0-16-centos kubespray-2.11.0]# pip3 install -r requirements.txt
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Requirement already satisfied: ansible==2.7.12 in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 1)) (2.7.12)
Requirement already satisfied: jinja2==2.10.1 in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 2)) (2.10.1)
Requirement already satisfied: netaddr==0.7.19 in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 3)) (0.7.19)
Requirement already satisfied: pbr==5.2.0 in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 4)) (5.2.0)
Requirement already satisfied: hvac==0.8.2 in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 5)) (0.8.2)
Requirement already satisfied: jmespath==0.9.4 in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 6)) (0.9.4)
Requirement already satisfied: ruamel.yaml==0.15.96 in /usr/local/lib64/python3.6/site-packages (from -r requirements.txt (line 7)) (0.15.96)
Requirement already satisfied: PyYAML in /usr/local/lib64/python3.6/site-packages (from ansible==2.7.12->-r requirements.txt (line 1)) (5.4.1)
Requirement already satisfied: paramiko in /usr/local/lib/python3.6/site-packages (from ansible==2.7.12->-r requirements.txt (line 1)) (2.7.2)
Requirement already satisfied: cryptography in /usr/local/lib64/python3.6/site-packages (from ansible==2.7.12->-r requirements.txt (line 1)) (3.4.7)
Requirement already satisfied: setuptools in /usr/lib/python3.6/site-packages (from ansible==2.7.12->-r requirements.txt (line 1)) (39.2.0)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib64/python3.6/site-packages (from jinja2==2.10.1->-r requirements.txt (line 2)) (2.0.1)
Requirement already satisfied: requests>=2.21.0 in /usr/local/lib/python3.6/site-packages (from hvac==0.8.2->-r requirements.txt (line 5)) (2.26.0)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests>=2.21.0->hvac==0.8.2->-r requirements.txt (line 5)) (3.2)
Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.6/site-packages (from requests>=2.21.0->hvac==0.8.2->-r requirements.txt (line 5)) (2.0.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests>=2.21.0->hvac==0.8.2->-r requirements.txt (line 5)) (1.26.6)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests>=2.21.0->hvac==0.8.2->-r requirements.txt (line 5)) (2021.5.30)
Requirement already satisfied: cffi>=1.12 in /usr/local/lib64/python3.6/site-packages (from cryptography->ansible==2.7.12->-r requirements.txt (line 1)) (1.14.6)
Requirement already satisfied: pycparser in /usr/local/lib/python3.6/site-packages (from cffi>=1.12->cryptography->ansible==2.7.12->-r requirements.txt (line 1)) (2.20)
Requirement already satisfied: pynacl>=1.0.1 in /usr/local/lib64/python3.6/site-packages (from paramiko->ansible==2.7.12->-r requirements.txt (line 1)) (1.4.0)
Requirement already satisfied: bcrypt>=3.1.3 in /usr/local/lib64/python3.6/site-packages (from paramiko->ansible==2.7.12->-r requirements.txt (line 1)) (3.2.0)
Requirement already satisfied: six>=1.4.1 in /usr/local/lib/python3.6/site-packages (from bcrypt>=3.1.3->paramiko->ansible==2.7.12->-r requirements.txt (line 1)) (1.16.0)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
其他问题处理
#阿里云镜像
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#阿里云doccker镜像
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum clean all
yum makecache
参考文档
网友评论