gpt4 book ai didi

docker - Kubernetes flannel pod 网络错误

转载 作者:行者123 更新时间:2023-12-02 18:39:42 26 4
gpt4 key购买 nike

在 pod 中运行的 Flannel 得到了错误的子网并且网络不愉快,症状是从 10.105.0.0/16 分配给 flannel/24。它应该从 10.105.5.128/21 分配/26。谢谢你的帮助。

详情如下:

/usr/bin/kubeadm init \
--kubernetes-version v1.7.5 \
--pod-network-cidr 10.105.5.128/21 \
--service-cidr 10.105.5.136/21 \
--token XXXXXXXXXXX

kube-flannel-rbac.yml 在 kube-flannel.yml 之后加载仅修改了 kube-flannel.yml 中的位(SubenetLen 和 Network):

{
"Network": "10.105.5.128/21",
"SubnetLen": 26,
"Backend": {
"Type": "vxlan"
}
}

DNS 在 systemd 文件中设置为:

--cluster-dns=10.105.5.136.10

使用 Ubuntu 16.04 LTS 和原版内核

这是 docker daemon.json 文件:

{
"hosts":[
"fd://",
"0.0.0.0"
],
"ip-masq":false,
"experimental": true,
"registry-mirrors": [
"http://hub.xyz.com"
],
"insecure-registries": [
"http://hub.xyz.com"
],
"tls": true,
"tlsverify": true,
"tlscacert":"/etc/docker/ca.pem",
"tlscert":"/etc/docker/cert.pem",
"tlskey":"/etc/docker/key.pem"
}

所有 kuberentes 组件都是从 ubuntu k8s repos 安装的 1.7.5

这是 kube-flannel 容器的日志:

I0926 03:29:10.214198      89 main.go:446] Determining IP address of default interface
I0926 03:29:10.216166 89 main.go:459] Using interface with name eth0 and address 10.105.5.12
I0926 03:29:10.216261 89 main.go:476] Defaulting external address to interface address (10.105.5.12)
I0926 03:29:10.242216 89 kube.go:283] Starting kube subnet manager
I0926 03:29:10.242055 89 kube.go:130] Waiting 10m0s for node controller to sync
I0926 03:29:11.242864 89 kube.go:137] Node controller sync successful
I0926 03:29:11.242957 89 main.go:226] Created subnet manager: Kubernetes Subnet Manager - kube-m2.XXXXX.com
I0926 03:29:11.242969 89 main.go:229] Installing signal handlers
I0926 03:29:11.243984 89 main.go:330] Found network config - Backend type: vxlan
I0926 03:29:11.288902 89 ipmasq.go:51] Adding iptables rule: -s 10.105.0.0/21 -d 10.105.0.0/21 -j RETURN
I0926 03:29:11.306692 89 ipmasq.go:51] Adding iptables rule: -s 10.105.0.0/21 ! -d 224.0.0.0/4 -j MASQUERADE
I0926 03:29:11.314413 89 ipmasq.go:51] Adding iptables rule: ! -s 10.105.0.0/21 -d 10.105.0.0/24 -j RETURN
I0926 03:29:11.323229 89 ipmasq.go:51] Adding iptables rule: ! -s 10.105.0.0/21 -d 10.105.0.0/21 -j MASQUERADE
I0926 03:29:11.329676 89 main.go:279] Wrote subnet file to /run/flannel/subnet.env
I0926 03:29:11.329746 89 main.go:284] Finished starting backend.
I0926 03:29:11.329829 89 vxlan_network.go:56] Watching for L3 misses
I0926 03:29:11.329903 89 vxlan_network.go:64] Watching for new subnet leases

最佳答案

你之前做过 kubeadm reset 吗?如果是,请通过使用检查ip链接ip链接

并检查flannel网络是否正确,如果不,请用
ip链接删除cni0
ip 链接删除 flannel.1
清理你的网络设置

祝你好运!

关于docker - Kubernetes flannel pod 网络错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46404266/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com