kubernetes修改为ipvs模式

  sre

252435076F654ACA7F155F1741DF9151.jpg

先升级内核 4.1以前内核不支持ipvs

centos7升级内核

/opt/ipvs_up.sh

#!/bin/bash
modprobe -- ip_vs
modprobe -- ip_vs_sh
modprobe -- ip_vs_rr
modprobe -- ip_vs_wrr
modprobe -- nf_conntrack_ipv4

/etc/rc.d/rc.local

chmod +x /opt/ipvs_up.sh
echo "/opt/ipvs_up.sh" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
bash ipvs_up.sh

edit configmap kube-proxy

kubectl edit configmap -n kube-system kube-proxy
# 找到这里,如果没修改过的,此处应当是空,直接写入ipvs即可
#mode: "ipvs" 

restart kube-proxy

kubectl get pod -n kube-system | grep kube-proxy | awk '{system("kubectl delete pod "$1" -n kube-system")}'

ipvs status

yum install ipset ipvsadm -y
ipvsadm -ln

One Reply to “kubernetes修改为ipvs模式”

LEAVE A COMMENT

Captcha Code