简体   繁体   English

Kubernetes Pod 从 docker 网络获取 IP

[英]Kubernetes Pods get IP from docker network

I have 3 masters, several workers and Calico as cni.我有 3 个主人,几个工人和印花布作为 cni。 Pods created on masters get 172.17.0.* IPs and this is docker network.在 master 上创建的 Pod 获得 172.17.0.* IP,这是 docker 网络。 Pods on workers get IP from calico pool as it should be.工人的豆荚应该从印花布池中获得 IP。 calicoctl show status ok for all nodes. calicoctl 显示所有节点的状态正常。

Also I have same kubelet parameters and config files and I don't have any pod cidr settings there.我也有相同的 kubelet 参数和配置文件,我没有任何 pod cidr 设置。 Kube-system/calico pods are up and running and logs do not show any reason. Kube-system/calico pod 已启动并运行,日志未显示任何原因。 How can I set correct cidr for pods on masters?如何在 master 上为 pod 设置正确的 cidr?

kubectl describe node master1 | egrep -i 'cidr|calico': 

    projectcalico.org/IPv4Address: 192.168.0.26/24
    projectcalico.org/IPv4IPIPTunnelAddr: 10.129.40.64
    PodCIDR:                      10.128.0.0/24
    PodCIDRs:                     10.128.0.0/24

pod details:吊舱详细信息:

kubectl describe po mypod | egrep -i 'master|ip'
Node:         master1/192.168.0.26
IP:           172.17.0.3
IPs:
  IP:           172.17.0.3

Posted community wiki based on comments for better visibility.基于评论发布社区 wiki 以获得更好的可见性。 Feel free to expand it.随意扩展它。


The solution for the issue is to add flag --network-plugin=cni to Kubelet startup options on the masters nodes (from the @mzv comment):该问题的解决方案是将标志--network-plugin=cni添加到主节点上的 Kubelet 启动选项(来自@mzv 评论):

I needed to add "--network-plugin=cni" to kubelet startup options我需要在 kubelet 启动选项中添加“--network-plugin=cni”

Instructions on how to add this flag to the Kubelet can be found here . 可以在此处找到有关如何将此标志添加到 Kubelet 的说明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM