2

在 pod 中运行的 Flannel 获得了错误的子网并且网络不满意,症状是 flannel 从 10.105.0.0/16 分配了 /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
4

1 回答 1

0

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

并检查法兰绒网络是否正确,如果不正确,请使用 ip link delete cni0 ip link delete flannel.1 清理您的网络设置

祝你好运!

于 2017-09-29T01:24:49.317 回答