Kube-OVN如何实现Pod和主机网络连通
下面从Kube-OVN代码看一下如何实现Pod和主机网络连通的,再在实验环境中按照Kube-OVN方式进行实验。 | Kube-OVN初始化ovn0 Kube-OVN在主机上添加一个OVS的internal port:ovn0,实现主机和OVS网络的通信。 1,将ovn0连接到OVS集成网桥br-int,类型为internal port,与交换机端口关联。 2,配置ovn0的MAC, IP, MTU并启动接口。 // InitNodeGateway init ovn0 func InitNodeGateway(config *Configuration) error { ... return configureNodeNic(portName, ipAddr, gw, mac, config.MTU) } func configureNodeNic(portName, ip, gw string, macAddr net.HardwareAddr, mtu int) error { ipStr := util.GetIpWithoutMask(ip) raw, err := ovs.Exec(ovs.MayExist, "add-port", "br-int", util.NodeNic, "--", "set", "interface", util.NodeNic, "type=internal", "--", "set", "interface", util.NodeNic, fmt.Sprintf("external_ids:iface-id=%s", portName), fmt.Sprintf("external_ids:ip=%s", ipStr)) if err != nil { klog.Errorf("failed to configure node nic %s: %v, %q", portName, err, raw) return fmt.