k8s手动设置ipvs
kubectl edit cm kube-proxy -n kube-system#修改如下kind: MasterConfigurationapiVersion: kubeadm.k8s.io/v1alpha1...ipvs:excludeCIDRs: nullminSyncPeriod: 0sscheduler: ""syncPeriod: 30skind: KubeProxyConfigur
·
kubectl edit cm kube-proxy -n kube-system
#修改如下
kind: MasterConfiguration
apiVersion: kubeadm.k8s.io/v1alpha1
...
ipvs:
excludeCIDRs: null
minSyncPeriod: 0s
scheduler: ""
syncPeriod: 30s
kind: KubeProxyConfiguration
metricsBindAddress: 127.0.0.1:10249
mode: "ipvs" #修改
...
[root@master nginx-test]# kubectl get pod -n kube-system | grep kube-proxy
kube-proxy-6p7ff 1/1 Running 2 2d1h
kube-proxy-xvvbc 1/1 Running 2 2d1h
重启各个节点上的kube-proxy(删除后会自动重新创建)
[root@master nginx-test]# kubectl get pod -n kube-system | grep kube-proxy |awk '{system("kubectl delete pod "$1" -n kube-system")}'
pod "kube-proxy-6p7ff" deleted
pod "kube-proxy-xvvbc" deleted
[root@master nginx-test]# kubectl get pod -n kube-system | grep kube-proxy
kube-proxy-f8d46 1/1 Running 0 12s
kube-proxy-wr5wz 1/1 Running 0 23s
可以得到如下的一些 ipvs 代理规则,
得到以下就成功了
[root@master ~]# ipvsadm -Ln
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 2.1.1.20:32150 rr
-> 10.244.1.9:80 Masq 1 0 7
-> 10.244.1.10:80 Masq 1 0 8
-> 10.244.1.11:80 Masq 1 0 7
TCP 10.96.0.1:443 rr
-> 2.1.1.20:6443 Masq 1 3 0
TCP 10.96.0.10:53 rr
-> 10.244.0.6:53 Masq 1 0 0
-> 10.244.0.7:53 Masq 1 0 0
TCP 10.96.0.10:9153 rr
-> 10.244.0.6:9153 Masq 1 0 0
-> 10.244.0.7:9153 Masq 1 0 0
TCP 10.100.46.127:80 rr
-> 10.244.1.9:80 Masq 1 0 0
-> 10.244.1.10:80 Masq 1 0 0
-> 10.244.1.11:80 Masq 1 0 0
TCP 10.244.0.0:32150 rr
-> 10.244.1.9:80 Masq 1 0 0
-> 10.244.1.10:80 Masq 1 0 0
-> 10.244.1.11:80 Masq 1 0 0
TCP 10.244.0.1:32150 rr
-> 10.244.1.9:80 Masq 1 0 0
-> 10.244.1.10:80 Masq 1 0 0
-> 10.244.1.11:80 Masq 1 0 0
TCP 127.0.0.1:32150 rr
-> 10.244.1.9:80 Masq 1 0 0
-> 10.244.1.10:80 Masq 1 0 0
-> 10.244.1.11:80 Masq 1 0 0
TCP 172.17.0.1:32150 rr
-> 10.244.1.9:80 Masq 1 0 0
-> 10.244.1.10:80 Masq 1 0 0
-> 10.244.1.11:80 Masq 1 0 0
UDP 10.96.0.10:53 rr
-> 10.244.0.6:53 Masq 1 0 0
-> 10.244.0.7:53 Masq 1 0 0
更多推荐
已为社区贡献82条内容
所有评论(0)