kube-proxy修改成ipvs模式

开启内核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

安装ipvs相关软件包

yum -y install ipvsadm ipset

修改kube-proxy启动脚本文件

#vim /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

重启服务及验证

 systemctl daemon-reload 
 systemctl restart kube-proxy 
 systemctl status kube-proxy 
 ipvsadm -L -n

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_43342753/article/details/89791351