#(1)开启内核node节点内核参数
#vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
# sysctl -p
#(2)安装ipvs相关软件包
yum -y install ipvsadm ipset
#(3)修改kube-proxy启动脚本文件
#/usr/lib/systemd/system/kube-proxy.service
[Unit]
Description=Kubernetes Kube-Proxy Server
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
After=network.target
[Service]
WorkingDirectory=/var/lib/kube-proxy
ExecStart=/usr/local/sbin/kube-proxy --bind-address=0.0.0.0 --hostname-override= --cluster-cidr=172.30.0.0/16 --kubeconfig=/opt/kubernetes/cfg/kube-proxy.kubeconfig --masquerade-all --feature-gates=SupportIPVSProxyMode=true --proxy-mode=ipvs --ipvs-min-sync-period=5s --ipvs-sync-period=5s --ipvs-scheduler=rr --logtostderr=true --v=2
Restart=on-failure
RestartSec=5
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
#(4)重启服务及验证
systemctl daemon-reload
systemctl restart kube-proxy
systemctl status kube-proxy
ipvsadm -L -n
原文地址:https://blog.51cto.com/1000682/2362853
时间: 2024-11-15 06:47:55