在部署集群的时候,需要对机器进行初始化。
需要配置一个自动加载模块的脚本
cat > /etc/sysconfig/modules/ipvs.modules <
cat > /etc/sysctl.d/k8s.conf << EOFnet.bridge.bridge-nf-call-ip6tables = 1net.bridge.bridge-nf-call-iptables = 1net.ipv4.ip_forward = 1net.ipv4.tcp_tw_recycle = 0vm.swappiness = 0 # 禁用swap,只有当系统OOM时才允许使用它vm.overcommit_memory = 1 # 不检查物理内存是否够用vm.panic_on_oom = 0 # 启用OOMfs.inotify.max_user_instances = 8192fs.inotify.max_user_watches = 1048576fs.fles-max = 52706963fs.nr_open = 52706963net.ipv6.conf.all.disable_ipv6 = 1net.netfilter.nf_conntrack_max = 2310720EOFsysctl --system
使用iptabels替换firewalld
yum -y install epel-releaseyum -y install conntrack ntpdate ntp ipvsadm ipset jq iptables curl sysstat libseccomp wget vim net-tools git# 使用iptablessystemctl stop firewalld && systemctl stop disable firewalldyum -y install iptables-servicessystemctl start iptablessystemctl enable iptables iptables -F && service iptables save
setenforce 0 && sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
timedatectl set-timezone Asia/Shanghaitimedatectl set-ntp yes
mkdir /var/log/journalmkdir /etc/systemd/journald.conf.d/cat > /etc/systemd/journald.conf.d/99-set.conf << EOF[Journal]# 持久化保存到磁盘Storage=persistent# 压缩日志Compress=yesSyncIntervalSec=5mRateLimitInterval=30sRateLimitBurst=1000# 最大占用空间SystemMaxUse=4G# 单个日志文件最大 200MSysstemMaxFileSize=200M# 日志保存时间2周MaxRetentionSec=2week# 不将日志转发到syslogForwardToSyslog=noEOFsystemctl restart systemd-journald
留言与评论(共有 0 条评论) “” |