default网络跨节点
如路径1所示,经过geneve隧道网络进行通信。
访问本节点api网络端点IP(分布式网关)
如路径2所示。
pod上流量通过pod内默认路由流向default网关;
-
流量流向join网关;
-
ovn-cluster路由器连接default subnet与join subnet。
[root@node1 ~]# kubectl get vpc -A NAME STANDBY SUBNETS NAMESPACES ovn-cluster true ["join","ovn-default"]
-
在ovn-cluster路由器上,默认路由指向join subnet的网关IP。
root@node1:/kube-ovn# ovn-nbctl list Logical_Router _uuid : c1cf493e-2db5-4c74-80ed-17a9e99aa3c6 copp : [] enabled : [] external_ids : {vendor=kube-ovn} load_balancer : [] load_balancer_group : [] name : ovn-cluster nat : [] options : {} policies : [08824336-8016-44f7-b20b-5f3f37f36582, 29f2559c-1357-441d-b692-ba888252f12d, 84da1ccf-e278-4508-9e2f-ea66224d16cb, 8b8358bc-b3a9-4925-93c8-0b192571833d, a95980e1-4c17-46b3-a26a-69468755c4c3, aa34537a-d704-4a7a-8d4f-bace2f70099a, b64ee9fe-b56a-4663-926b-61725ea602a0, bfebcdf9-57e1-427c-8506-c9970bcf02bf] ports : [43d0f4a3-df13-478c-b2f2-e7eaa8f2de37, f9b04f95-666f-4a18-a8b3-00d5e851a910] static_routes : [20d4eed7-ce19-42a8-a5ea-1a9931da876f] root@node1:/kube-ovn# ovn-nbctl list Logical_Router_Static_Route _uuid : 20d4eed7-ce19-42a8-a5ea-1a9931da876f bfd : [] external_ids : {} ip_prefix : "0.0.0.0/0" nexthop : "100.64.0.1" options : {} output_port : [] policy : dst-ip route_table : ""
-
-
流量流向本节点的OVN0,进入本节点内核网络;
-
ovn-cluster路由器上的路由策略将流量重定向至本节点OVN0上的IP。
root@node1:/kube-ovn# ovn-nbctl list Logical_Router _uuid : c1cf493e-2db5-4c74-80ed-17a9e99aa3c6 copp : [] enabled : [] external_ids : {vendor=kube-ovn} load_balancer : [] load_balancer_group : [] name : ovn-cluster nat : [] options : {} policies : [08824336-8016-44f7-b20b-5f3f37f36582, 29f2559c-1357-441d-b692-ba888252f12d, 84da1ccf-e278-4508-9e2f-ea66224d16cb, 8b8358bc-b3a9-4925-93c8-0b192571833d, a95980e1-4c17-46b3-a26a-69468755c4c3, aa34537a-d704-4a7a-8d4f-bace2f70099a, b64ee9fe-b56a-4663-926b-61725ea602a0, bfebcdf9-57e1-427c-8506-c9970bcf02bf] ports : [43d0f4a3-df13-478c-b2f2-e7eaa8f2de37, f9b04f95-666f-4a18-a8b3-00d5e851a910] static_routes : [20d4eed7-ce19-42a8-a5ea-1a9931da876f] root@node1:/kube-ovn# ovn-nbctl list Logical_Router_Policy _uuid : 8b8358bc-b3a9-4925-93c8-0b192571833d action : reroute external_ids : {node=node3, subnet=ovn-default, vendor=kube-ovn} match : "ip4.src == $ovn.default.node3_ip4" nexthop : [] nexthops : ["100.64.0.4"] options : {} priority : 29000
-
流量流向节点api网络端点IP;
-
返程流量原路返回;
-
根据节点上路由通过OVN0返回至join网关,再到default网关,再到pod。
[root@node3 ~]# ip r # default网段指向join网络网关 10.233.64.0/18 via 100.64.0.1 dev ovn0 # join网络通过OVN0设备IP进入 100.64.0.0/16 dev ovn0 proto kernel scope link src 100.64.0.4
-
访问跨节点api网络端点IP(分布式网关)
如路径3所示。
pod上流量通过pod内默认路由流向default网关;
-
流量流向join网关;
-
ovn-cluster路由器连接default subnet与join subnet。
[root@node1 ~]# kubectl get vpc -A NAME STANDBY SUBNETS NAMESPACES ovn-cluster true ["join","ovn-default"]
-
在ovn-cluster路由器上,默认路由指向join subnet的网关IP。
root@node1:/kube-ovn# ovn-nbctl list Logical_Router _uuid : c1cf493e-2db5-4c74-80ed-17a9e99aa3c6 copp : [] enabled : [] external_ids : {vendor=kube-ovn} load_balancer : [] load_balancer_group : [] name : ovn-cluster nat : [] options : {} policies : [08824336-8016-44f7-b20b-5f3f37f36582, 29f2559c-1357-441d-b692-ba888252f12d, 84da1ccf-e278-4508-9e2f-ea66224d16cb, 8b8358bc-b3a9-4925-93c8-0b192571833d, a95980e1-4c17-46b3-a26a-69468755c4c3, aa34537a-d704-4a7a-8d4f-bace2f70099a, b64ee9fe-b56a-4663-926b-61725ea602a0, bfebcdf9-57e1-427c-8506-c9970bcf02bf] ports : [43d0f4a3-df13-478c-b2f2-e7eaa8f2de37, f9b04f95-666f-4a18-a8b3-00d5e851a910] static_routes : [20d4eed7-ce19-42a8-a5ea-1a9931da876f] root@node1:/kube-ovn# ovn-nbctl list Logical_Router_Static_Route _uuid : 20d4eed7-ce19-42a8-a5ea-1a9931da876f bfd : [] external_ids : {} ip_prefix : "0.0.0.0/0" nexthop : "100.64.0.1" options : {} output_port : [] policy : dst-ip route_table : ""
-
-
流量通过隧道流向目标节点的OVN0,进入对端节点内核网络;
-
ovn-cluster路由器上的路由策略将流量重定向至对端节点OVN0上的IP。
root@node1:/kube-ovn# ovn-nbctl list Logical_Router _uuid : c1cf493e-2db5-4c74-80ed-17a9e99aa3c6 copp : [] enabled : [] external_ids : {vendor=kube-ovn} load_balancer : [] load_balancer_group : [] name : ovn-cluster nat : [] options : {} policies : [08824336-8016-44f7-b20b-5f3f37f36582, 29f2559c-1357-441d-b692-ba888252f12d, 84da1ccf-e278-4508-9e2f-ea66224d16cb, 8b8358bc-b3a9-4925-93c8-0b192571833d, a95980e1-4c17-46b3-a26a-69468755c4c3, aa34537a-d704-4a7a-8d4f-bace2f70099a, b64ee9fe-b56a-4663-926b-61725ea602a0, bfebcdf9-57e1-427c-8506-c9970bcf02bf] ports : [43d0f4a3-df13-478c-b2f2-e7eaa8f2de37, f9b04f95-666f-4a18-a8b3-00d5e851a910] static_routes : [20d4eed7-ce19-42a8-a5ea-1a9931da876f] root@node1:/kube-ovn# ovn-nbctl list Logical_Router_Policy _uuid : bfebcdf9-57e1-427c-8506-c9970bcf02bf action : reroute external_ids : {address-family="4", node=node1, vendor=kube-ovn} match : "ip4.dst == 192.168.123.21" nexthop : [] nexthops : ["100.64.0.2"] options : {} priority : 30000
-
流量流向节点api网络端点IP;
-
返程流量原路返回;
-
根据节点上路由通过OVN0返回至join网关,再到default网关,再到pod。
[root@node3 ~]# ip r # default网段指向join网络网关 10.233.64.0/18 via 100.64.0.1 dev ovn0 # join网络通过OVN0设备IP进入 100.64.0.0/16 dev ovn0 proto kernel scope link src 100.64.0.4
-
访问外网(分布式网关)
如路径4所示。
pod上流量通过pod内默认路由流向default网关;
-
流量流向join网关;
-
ovn-cluster路由器连接default subnet与join subnet。
[root@node1 ~]# kubectl get vpc -A NAME STANDBY SUBNETS NAMESPACES ovn-cluster true ["join","ovn-default"]
-
在ovn-cluster路由器上,默认路由指向join subnet的网关IP。
root@node1:/kube-ovn# ovn-nbctl list Logical_Router _uuid : c1cf493e-2db5-4c74-80ed-17a9e99aa3c6 copp : [] enabled : [] external_ids : {vendor=kube-ovn} load_balancer : [] load_balancer_group : [] name : ovn-cluster nat : [] options : {} policies : [08824336-8016-44f7-b20b-5f3f37f36582, 29f2559c-1357-441d-b692-ba888252f12d, 84da1ccf-e278-4508-9e2f-ea66224d16cb, 8b8358bc-b3a9-4925-93c8-0b192571833d, a95980e1-4c17-46b3-a26a-69468755c4c3, aa34537a-d704-4a7a-8d4f-bace2f70099a, b64ee9fe-b56a-4663-926b-61725ea602a0, bfebcdf9-57e1-427c-8506-c9970bcf02bf] ports : [43d0f4a3-df13-478c-b2f2-e7eaa8f2de37, f9b04f95-666f-4a18-a8b3-00d5e851a910] static_routes : [20d4eed7-ce19-42a8-a5ea-1a9931da876f] root@node1:/kube-ovn# ovn-nbctl list Logical_Router_Static_Route _uuid : 20d4eed7-ce19-42a8-a5ea-1a9931da876f bfd : [] external_ids : {} ip_prefix : "0.0.0.0/0" nexthop : "100.64.0.1" options : {} output_port : [] policy : dst-ip route_table : ""
-
-
流量流向本节点的OVN0,进入本节点内核网络;
-
ovn-cluster路由器上的路由策略将流量重定向至本节点OVN0上的IP。
root@node1:/kube-ovn# ovn-nbctl list Logical_Router _uuid : c1cf493e-2db5-4c74-80ed-17a9e99aa3c6 copp : [] enabled : [] external_ids : {vendor=kube-ovn} load_balancer : [] load_balancer_group : [] name : ovn-cluster nat : [] options : {} policies : [08824336-8016-44f7-b20b-5f3f37f36582, 29f2559c-1357-441d-b692-ba888252f12d, 84da1ccf-e278-4508-9e2f-ea66224d16cb, 8b8358bc-b3a9-4925-93c8-0b192571833d, a95980e1-4c17-46b3-a26a-69468755c4c3, aa34537a-d704-4a7a-8d4f-bace2f70099a, b64ee9fe-b56a-4663-926b-61725ea602a0, bfebcdf9-57e1-427c-8506-c9970bcf02bf] ports : [43d0f4a3-df13-478c-b2f2-e7eaa8f2de37, f9b04f95-666f-4a18-a8b3-00d5e851a910] static_routes : [20d4eed7-ce19-42a8-a5ea-1a9931da876f] root@node1:/kube-ovn# ovn-nbctl list Logical_Router_Policy _uuid : 8b8358bc-b3a9-4925-93c8-0b192571833d action : reroute external_ids : {node=node3, subnet=ovn-default, vendor=kube-ovn} match : "ip4.src == $ovn.default.node3_ip4" nexthop : [] nexthops : ["100.64.0.4"] options : {} priority : 29000
-
流量根据系统在本节点上配置的ipset、iptables规则,NAT成eth0的IP出网;