ansible二进制部署kubernetes集群

kubernetes版本1.21.5

需要的资源文件请自行到我的阿里云盘下载 https://www.aliyundrive.com/s/zVegF78ATDV

修改主机信息

#根据自己的主机信息自行修改
vim sshkeygen.sh 
#!/usr/bin/env bash
yum -y install ansible &>/dev/null
ansible_dir=$(pwd)/ansible
if [ $? -eq 0 ]; then
    echo "ansible安装成功"
    cp -r ${ansible_dir} /etc/
else
    echo "ansible安装失败"
fi

cat < hosts < kubernetes_IP.txt < kubernetes_hostname.txt <> $dir/vars/main.yml
  done
done

cat kubernetes_hostname.txt | while read line
do
  for dir in $( ls -l | grep k8s | awk '{print $9}' )
  do
    echo $line >> $dir/vars/main.yml
  done
done

部署

#等待部署完成即可使用
ansible-playbook role.yml

你可能感兴趣的:(ansible二进制部署kubernetes集群)