东湖之滨 发表于 2022-11-4 02:23:05

京东云开发者|IoT运维 - 如何部署一套高可用K8S集群

环境

https://p9.toutiaoimg.com/img/tos-cn-i-qvj2lq49k0/1257baca960b490c907637752e93ab8d~tplv-tt-shrink:640:0.image
准备工作

配置ansible(deploy 主机执行)
# ssh-keygen
# for i in 192.168.3.{21..28}; dossh-copy-id-i ~/.ssh/id_rsa.pub $i; done# cat /etc/ansible/hosts

192.168.3.21
192.168.3.22
192.168.3.23

192.168.3.24
192.168.3.25
192.168.3.26

192.168.3.27
192.168.3.28


k8s-master
k8s-worker优化主机配置

关闭防火墙和selinux
# ansible all -m shell -a "systemctl stop firewalld && systemctl disable firewalld"
# ansible all -m shell -a "sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config"修改limit
关闭交换分区
# swapoff -a
# ansiblek8s-m shell -a "yes | cp /etc/fstab /etc/fstab_bak"
# ansiblek8s-m shell -a "cat /etc/fstab_bak | grep -v swap > /etc/fstab"
# ansiblek8s-m shell -a "echo vm.swappiness = 0 >> /etc/sysctl.d/k8s.conf"
# ansiblek8s-m shell -a "sysctl -p /etc/sysctl.d/k8s.conf"配置ipvs

# cat /root/ipvs.sh #!/bin/bashyum -y install ipvsadm ipset####创建ipvs脚本 cat > /etc/sysconfig/modules/ipvs.modules/etc/sysctl.d/k8s.conf
页: [1]
查看完整版本: 京东云开发者|IoT运维 - 如何部署一套高可用K8S集群