ToB企服应用市场:ToB评测及商务社交产业平台

标题: 京东云开发者|IoT运维 - 如何部署一套高可用K8S集群 [打印本页]

作者: 东湖之滨    时间: 2022-11-4 02:23
标题: 京东云开发者|IoT运维 - 如何部署一套高可用K8S集群
环境


准备工作

配置ansible(deploy 主机执行)
  1. # ssh-keygen
  2. # for i in 192.168.3.{21..28}; do  ssh-copy-id  -i ~/.ssh/id_rsa.pub $i; done
复制代码
  1. [root@deploy ~]# cat /etc/ansible/hosts
  2. [etcd]
  3. 192.168.3.21
  4. 192.168.3.22
  5. 192.168.3.23
  6. [k8s-master]
  7. 192.168.3.24
  8. 192.168.3.25
  9. 192.168.3.26
  10. [k8s-worker]
  11. 192.168.3.27
  12. 192.168.3.28
  13. [k8s:children]
  14. k8s-master
  15. k8s-worker
复制代码
优化主机配置

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

[code]# cat /root/ipvs.sh #!/bin/bashyum -y install ipvsadm ipset####创建ipvs脚本 cat > /etc/sysconfig/modules/ipvs.modules  /etc/sysctl.d/k8s.conf




欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) Powered by Discuz! X3.4