Kubernetes法兰绒吊舱弄错了网络

时间:2017-09-25 11:36:15

标签: docker networking kubernetes flannel

法兰绒在一个吊舱中运行得到了错误的子网,网络也不高兴,症状是法兰绒被分配到/来自10.105.0.0/16。它应该是从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": "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

1 个答案:

答案 0 :(得分:0)

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

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

祝你好运!