diff --git a/v1.13.x/404.html b/v1.13.x/404.html index a1c5c83a2..c0b8871f9 100644 --- a/v1.13.x/404.html +++ b/v1.13.x/404.html @@ -1 +1 @@ - Kube-OVN 文档

404 - Not found

\ No newline at end of file + Kube-OVN 文档

404 - Not found

\ No newline at end of file diff --git a/v1.13.x/advance/accelerate-intra-node-tcp-with-ebpf/index.html b/v1.13.x/advance/accelerate-intra-node-tcp-with-ebpf/index.html index 457767457..7c4d9e088 100644 --- a/v1.13.x/advance/accelerate-intra-node-tcp-with-ebpf/index.html +++ b/v1.13.x/advance/accelerate-intra-node-tcp-with-ebpf/index.html @@ -1,4 +1,4 @@ - 使用 eBPF 加速节点内 TCP 通信 - Kube-OVN 文档
跳转至

Iptables Rules

Kube-OVN uses ipset and iptables to implement gateway NAT functionality in the default VPC overlay Subnets.

The ipset used is shown in the following table:

Name(IPv4/IPv6) Type Usage
ovn40services/ovn60services hash:net Service CIDR
ovn40subnets/ovn60subnets hash:net Overlay Subnet CIDR and NodeLocal DNS IP address
ovn40subnets-nat/ovn60subnets-nat hash:net Overlay Subnet CIDRs that enable NatOutgoing
ovn40subnets-distributed-gw/ovn60subnets-distributed-gw hash:net Overlay Subnet CIDRs that use distributed gateway
ovn40other-node/ovn60other-node hash:net Internal IP addresses for other Nodes
ovn40local-pod-ip-nat/ovn60local-pod-ip-nat hash:ip Deprecated
ovn40subnets-nat-policy hash:net All subnet cidrs configured with natOutgoingPolicyRules
ovn40natpr-418e79269dc5-dst hash:net The dstIPs corresponding to the rule in natOutgoingPolicyRules
ovn40natpr-418e79269dc5-src hash:net The srcIPs corresponding to the rule in natOutgoingPolicyRules

The iptables rules (IPv4) used are shown in the following table:

Table Chain Rule Usage Note
filter INPUT -m set --match-set ovn40services src -j ACCEPT Allow k8s service and pod traffic to pass through --
filter INPUT -m set --match-set ovn40services dst -j ACCEPT Allow k8s service and pod traffic to pass through --
filter INPUT -m set --match-set ovn40subnets src -j ACCEPT Allow k8s service and pod traffic to pass through --
filter INPUT -m set --match-set ovn40subnets dst -j ACCEPT Allow k8s service and pod traffic to pass through --
filter FORWARD -m set --match-set ovn40services src -j ACCEPT Allow k8s service and pod traffic to pass through --
filter FORWARD -m set --match-set ovn40services dst -j ACCEPT Allow k8s service and pod traffic to pass through --
filter FORWARD -m set --match-set ovn40subnets src -j ACCEPT Allow k8s service and pod traffic to pass through --
filter FORWARD -m set --match-set ovn40subnets dst -j ACCEPT Allow k8s service and pod traffic to pass through --
filter FORWARD -s 10.16.0.0/16 -m comment --comment "ovn-subnet-gateway,ovn-default" Used to count packets from the subnet to the external network "10.16.0.0/16" is the cidr of the subnet, the "ovn-subnet-gateway" before the "," in comment is used to identify the iptables rule used to count the subnet inbound and outbound gateway packets, and the "ovn-default" after the "," is the name of the subnet
filter FORWARD -d 10.16.0.0/16 -m comment --comment "ovn-subnet-gateway,ovn-default" Used to count packets from the external network accessing the subnet "10.16.0.0/16" is the cidr of the subnet, the "ovn-subnet-gateway" before the "," in comment is used to identify the iptables rule used to count the subnet inbound and outbound gateway packets, and the "ovn-default" after the "," is the name of the subnet
filter OUTPUT -p udp -m udp --dport 6081 -j MARK --set-xmark 0x0 Clear traffic tag to prevent SNAT UDP: bad checksum on VXLAN interface
nat PREROUTING -m comment --comment "kube-ovn prerouting rules" -j OVN-PREROUTING Enter OVN-PREROUTING chain processing --
nat POSTROUTING -m comment --comment "kube-ovn postrouting rules" -j OVN-POSTROUTING Enter OVN-POSTROUTING chain processing --
nat OVN-PREROUTING -i ovn0 -m set --match-set ovn40subnets src -m set --match-set ovn40services dst -j MARK --set-xmark 0x4000/0x4000 Adding masquerade tags to Pod access service traffic Used when the built-in LB is turned off
nat OVN-PREROUTING -p tcp -m addrtype --dst-type LOCAL -m set --match-set KUBE-NODE-PORT-LOCAL-TCP dst -j MARK --set-xmark 0x80000/0x80000 Add specific tags to ExternalTrafficPolicy for Local's Service traffic (TCP) Only used when kube-proxy is using ipvs mode
nat OVN-PREROUTING -p udp -m addrtype --dst-type LOCAL -m set --match-set KUBE-NODE-PORT-LOCAL-UDP dst -j MARK --set-xmark 0x80000/0x80000 Add specific tags to ExternalTrafficPolicy for Local's Service traffic (UDP) Only used when kube-proxy is using ipvs mode
nat OVN-POSTROUTING -m set --match-set ovn40services src -m set --match-set ovn40subnets dst -m mark --mark 0x4000/0x4000 -j SNAT --to-source Use node IP as the source address for access from node to overlay Pods via service IP。 Works only when kube-proxy is using ipvs mode
nat OVN-POSTROUTING -m mark --mark 0x4000/0x4000 -j MASQUERADE Perform SNAT for specific tagged traffic --
nat OVN-POSTROUTING -m set --match-set ovn40subnets src -m set --match-set ovn40subnets dst -j MASQUERADE Perform SNAT for Service traffic between Pods passing through the node --
nat OVN-POSTROUTING -m mark --mark 0x80000/0x80000 -m set --match-set ovn40subnets-distributed-gw dst -j RETURN For Service traffic where ExternalTrafficPolicy is Local, if the Endpoint uses a distributed gateway, SNAT is not required. --
nat OVN-POSTROUTING -m mark --mark 0x80000/0x80000 -j MASQUERADE For Service traffic where ExternalTrafficPolicy is Local, if the Endpoint uses a centralized gateway, SNAT is required. --
nat OVN-POSTROUTING -p tcp -m tcp --tcp-flags SYN NONE -m conntrack --ctstate NEW -j RETURN No SNAT is performed when the Pod IP is exposed to the outside world --
nat OVN-POSTROUTING -s 10.16.0.0/16 -m set ! --match-set ovn40subnets dst -j SNAT --to-source 192.168.0.101 When the Pod accesses the network outside the cluster, if the subnet is NatOutgoing and a centralized gateway with the specified IP is used, perform SNAT 10.16.0.0/16 is the Subnet CIDR,192.168.0.101 is the specified IP of gateway node
nat OVN-POSTROUTING -m set --match-set ovn40subnets-nat src -m set ! --match-set ovn40subnets dst -j MASQUERADE When the Pod accesses the network outside the cluster, if NatOutgoing is enabled on the subnet, perform SNAT --
nat OVN-POSTROUTING -m set --match-set ovn40subnets-nat-policy src -m set ! --match-set ovn40subnets dst -j OVN-NAT-POLICY When Pod accesses the network outside the cluster, if natOutgoingPolicyRules is enabled on the subnet, the packet with the specified policy will perform SNAT ovn40subnets-nat-policy is all subnet segments configured with natOutgoingPolicyRules
nat OVN-POSTROUTING -m mark --mark 0x90001/0x90001 -j MASQUERADE --random-fully When Pod accesses the network outside the cluster, if natOutgoingPolicyRules is enabled on the subnet, the packet with the specified policy will perform SNAT After coming out of OVN-NAT-POLICY, if it is tagged with 0x90001/0x90001, it will do SNAT
nat OVN-POSTROUTING -m mark --mark 0x90002/0x90002 -j RETURN When Pod accesses the network outside the cluster, if natOutgoingPolicyRules is enabled on the subnet, the packet with the specified policy will perform SNAT After coming out of OVN-NAT-POLICY, if it is tagged with 0x90002/0x90002, it will not do SNAT
nat OVN-NAT-POLICY -s 10.0.11.0/24 -m comment --comment natPolicySubnet-net1 -j OVN-NAT-PSUBNET-aa98851157c5 When Pod accesses the network outside the cluster, if natOutgoingPolicyRules is enabled on the subnet, the packet with the specified policy will perform SNAT 10.0.11.0/24 represents the CIDR of the subnet net1, and the rules under the OVN-NAT-PSUBNET-aa98851157c5 chain correspond to the natOutgoingPolicyRules configuration of this subnet
nat OVN-NAT-PSUBNET-xxxxxxxxxxxx -m set --match-set ovn40natpr-418e79269dc5-src src -m set --match-set ovn40natpr-418e79269dc5-dst dst -j MARK --set-xmark 0x90002/0x90002 When Pod accesses the network outside the cluster, if natOutgoingPolicyRules is enabled on the subnet, the packet with the specified policy will perform SNAT 418e79269dc5 indicates the ID of a rule in natOutgoingPolicyRules, which can be viewed through status.natOutgoingPolicyRules[index].RuleID, indicating that srcIPs meets ovn40natpr-418e79269dc5-src, and dstIPS meets ovn40natpr-418e79269dc5- dst will be marked with tag 0x90002
mangle OVN-OUTPUT -d 10.241.39.2/32 -p tcp -m tcp --dport 80 -j MARK --set-xmark 0x90003/0x90003 Introduce kubelet's detection traffic to tproxy with a specific mark
mangle OVN-PREROUTING -d 10.241.39.2/32 -p tcp -m tcp --dport 80 -j TPROXY --on-port 8102 --on-ip 172.18.0.3 --tproxy-mark 0x90004/0x90004 Introduce kubelet's detection traffic to tproxy with a specific mark

微信群 Slack Twitter Support


Last update: July 13, 2023
Created: September 6, 2022

Comments

Iptables Rules

Kube-OVN uses ipset and iptables to implement gateway NAT functionality in the default VPC overlay Subnets.

The ipset used is shown in the following table:

Name(IPv4/IPv6) Type Usage
ovn40services/ovn60services hash:net Service CIDR
ovn40subnets/ovn60subnets hash:net Overlay Subnet CIDR and NodeLocal DNS IP address
ovn40subnets-nat/ovn60subnets-nat hash:net Overlay Subnet CIDRs that enable NatOutgoing
ovn40subnets-distributed-gw/ovn60subnets-distributed-gw hash:net Overlay Subnet CIDRs that use distributed gateway
ovn40other-node/ovn60other-node hash:net Internal IP addresses for other Nodes
ovn40local-pod-ip-nat/ovn60local-pod-ip-nat hash:ip Deprecated
ovn40subnets-nat-policy hash:net All subnet cidrs configured with natOutgoingPolicyRules
ovn40natpr-418e79269dc5-dst hash:net The dstIPs corresponding to the rule in natOutgoingPolicyRules
ovn40natpr-418e79269dc5-src hash:net The srcIPs corresponding to the rule in natOutgoingPolicyRules

The iptables rules (IPv4) used are shown in the following table:

Table Chain Rule Usage Note
filter INPUT -m set --match-set ovn40services src -j ACCEPT Allow k8s service and pod traffic to pass through --
filter INPUT -m set --match-set ovn40services dst -j ACCEPT Allow k8s service and pod traffic to pass through --
filter INPUT -m set --match-set ovn40subnets src -j ACCEPT Allow k8s service and pod traffic to pass through --
filter INPUT -m set --match-set ovn40subnets dst -j ACCEPT Allow k8s service and pod traffic to pass through --
filter FORWARD -m set --match-set ovn40services src -j ACCEPT Allow k8s service and pod traffic to pass through --
filter FORWARD -m set --match-set ovn40services dst -j ACCEPT Allow k8s service and pod traffic to pass through --
filter FORWARD -m set --match-set ovn40subnets src -j ACCEPT Allow k8s service and pod traffic to pass through --
filter FORWARD -m set --match-set ovn40subnets dst -j ACCEPT Allow k8s service and pod traffic to pass through --
filter FORWARD -s 10.16.0.0/16 -m comment --comment "ovn-subnet-gateway,ovn-default" Used to count packets from the subnet to the external network "10.16.0.0/16" is the cidr of the subnet, the "ovn-subnet-gateway" before the "," in comment is used to identify the iptables rule used to count the subnet inbound and outbound gateway packets, and the "ovn-default" after the "," is the name of the subnet
filter FORWARD -d 10.16.0.0/16 -m comment --comment "ovn-subnet-gateway,ovn-default" Used to count packets from the external network accessing the subnet "10.16.0.0/16" is the cidr of the subnet, the "ovn-subnet-gateway" before the "," in comment is used to identify the iptables rule used to count the subnet inbound and outbound gateway packets, and the "ovn-default" after the "," is the name of the subnet
filter OUTPUT -p udp -m udp --dport 6081 -j MARK --set-xmark 0x0 Clear traffic tag to prevent SNAT UDP: bad checksum on VXLAN interface
nat PREROUTING -m comment --comment "kube-ovn prerouting rules" -j OVN-PREROUTING Enter OVN-PREROUTING chain processing --
nat POSTROUTING -m comment --comment "kube-ovn postrouting rules" -j OVN-POSTROUTING Enter OVN-POSTROUTING chain processing --
nat OVN-PREROUTING -i ovn0 -m set --match-set ovn40subnets src -m set --match-set ovn40services dst -j MARK --set-xmark 0x4000/0x4000 Adding masquerade tags to Pod access service traffic Used when the built-in LB is turned off
nat OVN-PREROUTING -p tcp -m addrtype --dst-type LOCAL -m set --match-set KUBE-NODE-PORT-LOCAL-TCP dst -j MARK --set-xmark 0x80000/0x80000 Add specific tags to ExternalTrafficPolicy for Local's Service traffic (TCP) Only used when kube-proxy is using ipvs mode
nat OVN-PREROUTING -p udp -m addrtype --dst-type LOCAL -m set --match-set KUBE-NODE-PORT-LOCAL-UDP dst -j MARK --set-xmark 0x80000/0x80000 Add specific tags to ExternalTrafficPolicy for Local's Service traffic (UDP) Only used when kube-proxy is using ipvs mode
nat OVN-POSTROUTING -m set --match-set ovn40services src -m set --match-set ovn40subnets dst -m mark --mark 0x4000/0x4000 -j SNAT --to-source Use node IP as the source address for access from node to overlay Pods via service IP。 Works only when kube-proxy is using ipvs mode
nat OVN-POSTROUTING -m mark --mark 0x4000/0x4000 -j MASQUERADE Perform SNAT for specific tagged traffic --
nat OVN-POSTROUTING -m set --match-set ovn40subnets src -m set --match-set ovn40subnets dst -j MASQUERADE Perform SNAT for Service traffic between Pods passing through the node --
nat OVN-POSTROUTING -m mark --mark 0x80000/0x80000 -m set --match-set ovn40subnets-distributed-gw dst -j RETURN For Service traffic where ExternalTrafficPolicy is Local, if the Endpoint uses a distributed gateway, SNAT is not required. --
nat OVN-POSTROUTING -m mark --mark 0x80000/0x80000 -j MASQUERADE For Service traffic where ExternalTrafficPolicy is Local, if the Endpoint uses a centralized gateway, SNAT is required. --
nat OVN-POSTROUTING -p tcp -m tcp --tcp-flags SYN NONE -m conntrack --ctstate NEW -j RETURN No SNAT is performed when the Pod IP is exposed to the outside world --
nat OVN-POSTROUTING -s 10.16.0.0/16 -m set ! --match-set ovn40subnets dst -j SNAT --to-source 192.168.0.101 When the Pod accesses the network outside the cluster, if the subnet is NatOutgoing and a centralized gateway with the specified IP is used, perform SNAT 10.16.0.0/16 is the Subnet CIDR,192.168.0.101 is the specified IP of gateway node
nat OVN-POSTROUTING -m set --match-set ovn40subnets-nat src -m set ! --match-set ovn40subnets dst -j MASQUERADE When the Pod accesses the network outside the cluster, if NatOutgoing is enabled on the subnet, perform SNAT --
nat OVN-POSTROUTING -m set --match-set ovn40subnets-nat-policy src -m set ! --match-set ovn40subnets dst -j OVN-NAT-POLICY When Pod accesses the network outside the cluster, if natOutgoingPolicyRules is enabled on the subnet, the packet with the specified policy will perform SNAT ovn40subnets-nat-policy is all subnet segments configured with natOutgoingPolicyRules
nat OVN-POSTROUTING -m mark --mark 0x90001/0x90001 -j MASQUERADE --random-fully When Pod accesses the network outside the cluster, if natOutgoingPolicyRules is enabled on the subnet, the packet with the specified policy will perform SNAT After coming out of OVN-NAT-POLICY, if it is tagged with 0x90001/0x90001, it will do SNAT
nat OVN-POSTROUTING -m mark --mark 0x90002/0x90002 -j RETURN When Pod accesses the network outside the cluster, if natOutgoingPolicyRules is enabled on the subnet, the packet with the specified policy will perform SNAT After coming out of OVN-NAT-POLICY, if it is tagged with 0x90002/0x90002, it will not do SNAT
nat OVN-NAT-POLICY -s 10.0.11.0/24 -m comment --comment natPolicySubnet-net1 -j OVN-NAT-PSUBNET-aa98851157c5 When Pod accesses the network outside the cluster, if natOutgoingPolicyRules is enabled on the subnet, the packet with the specified policy will perform SNAT 10.0.11.0/24 represents the CIDR of the subnet net1, and the rules under the OVN-NAT-PSUBNET-aa98851157c5 chain correspond to the natOutgoingPolicyRules configuration of this subnet
nat OVN-NAT-PSUBNET-xxxxxxxxxxxx -m set --match-set ovn40natpr-418e79269dc5-src src -m set --match-set ovn40natpr-418e79269dc5-dst dst -j MARK --set-xmark 0x90002/0x90002 When Pod accesses the network outside the cluster, if natOutgoingPolicyRules is enabled on the subnet, the packet with the specified policy will perform SNAT 418e79269dc5 indicates the ID of a rule in natOutgoingPolicyRules, which can be viewed through status.natOutgoingPolicyRules[index].RuleID, indicating that srcIPs meets ovn40natpr-418e79269dc5-src, and dstIPS meets ovn40natpr-418e79269dc5- dst will be marked with tag 0x90002
mangle OVN-OUTPUT -d 10.241.39.2/32 -p tcp -m tcp --dport 80 -j MARK --set-xmark 0x90003/0x90003 Introduce kubelet's detection traffic to tproxy with a specific mark
mangle OVN-PREROUTING -d 10.241.39.2/32 -p tcp -m tcp --dport 80 -j TPROXY --on-port 8102 --on-ip 172.18.0.3 --tproxy-mark 0x90004/0x90004 Introduce kubelet's detection traffic to tproxy with a specific mark

微信群 Slack Twitter Support


Last update: July 13, 2023
Created: September 6, 2022

Comments

Kube-OVN API Reference

Based on Kube-OVN v1.12.0, we have compiled a list of CRD resources supported by Kube-OVN, listing the types and meanings of each field of CRD definition for reference.

Generic Condition Definition

Property Name Type Description
type String Type of status
status String The value of status, in the range of True, False or Unknown
reason String The reason for the status change
message String The specific message of the status change
lastUpdateTime Time The last time the status was updated
lastTransitionTime Time Time of last status type change

In each CRD definition, the Condition field in Status follows the above format, so we explain it in advance.

Subnet Definition

Subnet

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have this value as kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value Subnet
metadata ObjectMeta Standard Kubernetes resource metadata information
spec SubnetSpec Subnet specific configuration information
status SubnetStatus Subnet status information

SubnetSpec

Property Name Type Description
default Bool Whether this subnet is the default subnet
vpc String The vpc which the subnet belongs to, default is ovn-cluster
protocol String IP protocol, the value is in the range of IPv4, IPv6 or Dual
namespaces []String The list of namespaces bound to this subnet
cidrBlock String The range of the subnet, e.g. 10.16.0.0/16
gateway String The gateway address of the subnet, the default value is the first available address under the CIDRBlock of the subnet
excludeIps []String The range of addresses under this subnet that will not be automatically assigned
provider String Default value is ovn. In the case of multiple NICs, the value is <name>.<namespace> of the NetworkAttachmentDefinition, Kube-OVN will use this information to find the corresponding subnet resource
gatewayType String The gateway type in overlay mode, either distributed or centralized
gatewayNode String The gateway node when the gateway mode is centralized, node names can be comma-separated
natOutgoing Bool Whether the outgoing traffic is NAT
externalEgressGateway String The address of the external gateway. This parameter and the natOutgoing parameter cannot be set at the same time
policyRoutingPriority Uint32 Policy route priority. Used to control the forwarding of traffic to the external gateway address after the subnet gateway
policyRoutingTableID Uint32 The TableID of the local policy routing table, should be different for each subnet to avoid conflicts
private Bool Whether the subnet is a private subnet, which denies access to addresses inside the subnet if the subnet is private
allowSubnets []String If the subnet is a private subnet, the set of addresses that are allowed to access the subnet
vlan String The name of vlan to which the subnet is bound
vips []String The virtual-ip parameter information for virtual type lsp on the subnet
logicalGateway Bool Whether to enable logical gateway
disableGatewayCheck Bool Whether to skip the gateway connectivity check when creating a pod
disableInterConnection Bool Whether to enable subnet interconnection across clusters
enableDHCP Bool Whether to configure dhcp configuration options for lsps belong this subnet
dhcpV4Options String The DHCP_Options record associated with lsp dhcpv4_options on the subnet
dhcpV6Options String The DHCP_Options record associated with lsp dhcpv6_options on the subnet
enableIPv6RA Bool Whether to configure the ipv6_ra_configs parameter for the lrp port of the router connected to the subnet
ipv6RAConfigs String The ipv6_ra_configs parameter configuration for the lrp port of the router connected to the subnet
acls []Acl The acls record associated with the logical-switch of the subnet
u2oInterconnection Bool Whether to enable interconnection mode for Overlay/Underlay
enableLb *Bool Whether the logical-switch of the subnet is associated with load-balancer records
enableEcmp Bool Centralized subnet, whether to enable ECMP routing
Acl
Property Name Type Description
direction String Restrict the direction of acl, which value is from-lport or to-lport
priority Int Acl priority, in the range 0 to 32767
match String Acl rule match expression
action String The action of the rule, which value is in the range of allow-related, allow-stateless, allow, drop, reject

SubnetStatus

Property Name Type Description
conditions []SubnetCondition Subnet status change information, refer to the beginning of the document for the definition of Condition
v4AvailableIPs Float64 Number of available IPv4 IPs
v4availableIPrange String The available range of IPv4 addresses on the subnet
v4UsingIPs Float64 Number of used IPv4 IPs
v4usingIPrange String Used IPv4 address ranges on the subnet
v6AvailableIPs Float64 Number of available IPv6 IPs
v6availableIPrange String The available range of IPv6 addresses on the subnet
v6UsingIPs Float64 Number of used IPv6 IPs
v6usingIPrange String Used IPv6 address ranges on the subnet
sctivateGateway String The currently working gateway node in centralized subnet of master-backup mode
dhcpV4OptionsUUID String The DHCP_Options record identifier associated with the lsp dhcpv4_options on the subnet
dhcpV6OptionsUUID String The DHCP_Options record identifier associated with the lsp dhcpv6_options on the subnet
u2oInterconnectionIP String The IP address used for interconnection when Overlay/Underlay interconnection mode is enabled

IP Definition

IP

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources are kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource have the value IP
metadata ObjectMeta Standard Kubernetes resource metadata information
spec IPSpec IP specific configuration information

IPSepc

Property Name Type Description
podName String Pod name which assigned with this IP
namespace String The name of the namespace where the pod is bound
subnet String The subnet which the ip belongs to
attachSubnets []String The name of the other subnets attached to this primary IP (field deprecated)
nodeName String The name of the node where the pod is bound
ipAddress String IP address, in v4IP,v6IP format for dual-stack cases
v4IPAddress String IPv4 IP address
v6IPAddress String IPv6 IP address
attachIPs []String Other IP addresses attached to this primary IP (field is deprecated)
macAddress String The Mac address of the bound pod
attachMacs []String Other Mac addresses attached to this primary IP (field deprecated)
containerID String The Container ID corresponding to the bound pod
podType String Special workload pod, can be StatefulSet, VirtualMachine or empty

Underlay configuration

Vlan

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all instances of this resource will be kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value Vlan
metadata ObjectMeta Standard Kubernetes resource metadata information
spec VlanSpec Vlan specific configuration information
status VlanStatus Vlan status information

VlanSpec

Property Name Type Description
id Int Vlan tag number, in the range of 0~4096
provider String The name of the ProviderNetwork to which the vlan is bound

VlanStatus

Property Name Type Description
subnets []String The list of subnets to which the vlan is bound
conditions []VlanCondition Vlan status change information, refer to the beginning of the document for the definition of Condition

ProviderNetwork

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources are kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value ProviderNetwork
metadata ObjectMeta Standard Kubernetes resource metadata information
spec ProviderNetworkSpec ProviderNetwork specific configuration information
status ProviderNetworkStatus ProviderNetwork status information

ProviderNetworkSpec

Property Name Type Description
defaultInterface String The name of the NIC interface used by default for this bridge network
customInterfaces []CustomInterface The special NIC configuration used by this bridge network
excludeNodes []String The names of the nodes that will not be bound to this bridge network
exchangeLinkName Bool Whether to exchange the bridge NIC and the corresponding OVS bridge name
CustomInterface
Property Name Type Description
interface String NIC interface name used for underlay
nodes []String List of nodes using the custom NIC interface

ProviderNetworkStatus

Property Name Type Description
ready Bool Whether the current bridge network is in the ready state
readyNodes []String The name of the node whose bridge network is ready
notReadyNodes []String The name of the node whose bridge network is not ready
vlans []String The name of the vlan to which the bridge network is bound
conditions []ProviderNetworkCondition ProviderNetwork status change information, refer to the beginning of the document for the definition of Condition

Vpc Definition

Vpc

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have this value as kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value Vpc
metadata ObjectMeta Standard Kubernetes resource metadata information
spec VpcSpec Vpc specific configuration information
status VpcStatus Vpc status information

VpcSpec

Property Name Type Description
namespaces []String List of namespaces bound by Vpc
staticRoutes []*StaticRoute The static route information configured under Vpc
policyRoutes []*PolicyRoute The policy route information configured under Vpc
vpcPeerings []*VpcPeering Vpc interconnection information
enableExternal Bool Whether vpc is connected to an external switch
StaticRoute
Property Name Type Description
policy String Routing policy, takes the value of policySrc or policyDst
cidr String Routing cidr value
nextHopIP String The next hop information of the route
PolicyRoute
Property Name Type Description
priority Int32 Priority for policy route
match String Match expression for policy route
action String Action for policy route, the value is in the range of allow, drop, reroute
nextHopIP String The next hop of the policy route, separated by commas in the case of ECMP routing
VpcPeering
Property Name Type Description
remoteVpc String Name of the interconnected peering vpc
localConnectIP String The local ip for vpc used to connect to peer vpc

VpcStatus

Property Name Type Description
conditions []VpcCondition Vpc status change information, refer to the beginning of the documentation for the definition of Condition
standby Bool Whether the vpc creation is complete, the subnet under the vpc needs to wait for the vpc creation to complete other proceeding
default Bool Whether it is the default vpc
defaultLogicalSwitch String The default subnet under vpc
router String The logical-router name for the vpc
tcpLoadBalancer String TCP LB information for vpc
udpLoadBalancer String UDP LB information for vpc
tcpSessionLoadBalancer String TCP Session Hold LB Information for Vpc
udpSessionLoadBalancer String UDP session hold LB information for Vpc
subnets []String List of subnets for vpc
vpcPeerings []String List of peer vpcs for vpc interconnection
enableExternal Bool Whether the vpc is connected to an external switch

VpcNatGateway

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources are kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value VpcNatGateway
metadata ObjectMeta Standard Kubernetes resource metadata information
spec VpcNatSpec Vpc gateway specific configuration information

VpcNatSpec

Property Name Type Description
vpc String Vpc name which the vpc gateway belongs to
subnet String The name of the subnet to which the gateway pod belongs
lanIp String The IP address assigned to the gateway pod
selector []String Standard Kubernetes selector match information
tolerations []VpcNatToleration Standard Kubernetes tolerance information
VpcNatToleration
Property Name Type Description
key String The key information of the taint tolerance
operator String Takes the value of Exists or Equal
value String The value information of the taint tolerance
effect String The effect of the taint tolerance, takes the value of NoExecute, NoSchedule, or PreferNoSchedule
tolerationSeconds Int64 The amount of time the pod can continue to run on the node after the taint is added

The meaning of the above tolerance fields can be found in the official Kubernetes documentation Taint and Tolerance.

IptablesEIP

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have this value as kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource have the value IptablesEIP
metadata ObjectMeta Standard Kubernetes resource metadata information
spec IptablesEipSpec IptablesEIP specific configuration information used by vpc gateway
status IptablesEipStatus IptablesEIP status information used by vpc gateway

IptablesEipSpec

Property Name Type Description
v4ip String IptablesEIP v4 address
v6ip String IptablesEIP v6 address
macAddress String The assigned mac address, not actually used
natGwDp String Vpc gateway name

IptablesEipStatus

Property Name Type Description
ready Bool Whether IptablesEIP is configured complete
ip String The IP address used by IptablesEIP, currently only IPv4 addresses are supported
redo String IptablesEIP crd creation or update time
nat String The type of IptablesEIP, either fip, snat, or dnat
conditions []IptablesEIPCondition IptablesEIP status change information, refer to the beginning of the documentation for the definition of Condition

IptablesFIPRule

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have this value as kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource have the value IptablesFIPRule
metadata ObjectMeta Standard Kubernetes resource metadata information
spec IptablesFIPRuleSpec The IptablesFIPRule specific configuration information used by vpc gateway
status IptablesFIPRuleStatus IptablesFIPRule status information used by vpc gateway

IptablesFIPRuleSpec

Property Name Type Description
eip String Name of the IptablesEIP used for IptablesFIPRule
internalIp String The corresponding internal IP address

IptablesFIPRuleStatus

Property Name Type Description
ready Bool Whether IptablesFIPRule is configured or not
v4ip String The v4 IP address used by IptablesEIP
v6ip String The v6 IP address used by IptablesEIP
natGwDp String Vpc gateway name
redo String IptablesFIPRule crd creation or update time
conditions []IptablesFIPRuleCondition IptablesFIPRule status change information, refer to the beginning of the documentation for the definition of Condition

IptablesSnatRule

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have this value as kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource have the value IptablesSnatRule
metadata ObjectMeta Standard Kubernetes resource metadata information
spec IptablesSnatRuleSpec The IptablesSnatRule specific configuration information used by the vpc gateway
status IptablesSnatRuleStatus IptablesSnatRule status information used by vpc gateway

IptablesSnatRuleSpec

Property Name Type Description
eip String Name of the IptablesEIP used by IptablesSnatRule
internalIp String IptablesSnatRule's corresponding internal IP address

IptablesSnatRuleStatus

Property Name Type Description
ready Bool Whether the configuration is complete
v4ip String The v4 IP address used by IptablesSnatRule
v6ip String The v6 IP address used by IptablesSnatRule
natGwDp String Vpc gateway name
redo String IptablesSnatRule crd creation or update time
conditions []IptablesSnatRuleCondition IptablesSnatRule status change information, refer to the beginning of the documentation for the definition of Condition

IptablesDnatRule

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have this value as kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource have the value IptablesDnatRule
metadata ObjectMeta Standard Kubernetes resource metadata information
spec IptablesDnatRuleSpec The IptablesDnatRule specific configuration information used by vpc gateway
status IptablesDnatRuleStatus IptablesDnatRule status information used by vpc gateway

IptablesDnatRuleSpec

Property Name Type Description
eip Sting Name of IptablesEIP used by IptablesDnatRule
externalPort Sting External port used by IptablesDnatRule
protocol Sting Vpc gateway dnat protocol type
internalIp Sting Internal IP address used by IptablesDnatRule
internalPort Sting Internal port used by IptablesDnatRule

IptablesDnatRuleStatus

Property Name Type Description
ready Bool Whether the configuration is complete
v4ip String The v4 IP address used by IptablesDnatRule
v6ip String The v6 IP address used by IptablesDnatRule
natGwDp String Vpc gateway name
redo String IptablesDnatRule crd creation or update time
conditions []IptablesDnatRuleCondition IptablesDnatRule Status change information, refer to the beginning of the documentation for the definition of Condition

VpcDns

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value VpcDns
metadata ObjectMeta Standard Kubernetes resource metadata information
spec VpcDnsSpec VpcDns specific configuration information
status VpcDnsStatus VpcDns status information

VpcDnsSpec

Property Name Type Description
vpc String Name of the vpc where VpcDns is located
subnet String The subnet name of the address assigned to the VpcDns pod

VpcDnsStatus

Property Name Type Description
conditions []VpcDnsCondition VpcDns status change information, refer to the beginning of the document for the definition of Condition
active Bool Whether VpcDns is in use

For detailed documentation on the use of VpcDns, see Customizing VPC DNS.

SwitchLBRule

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have this value as kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value SwitchLBRule
metadata ObjectMeta Standard Kubernetes resource metadata information
spec SwitchLBRuleSpec SwitchLBRule specific configuration information
status SwitchLBRuleStatus SwitchLBRule status information

SwitchLBRuleSpec

Property Name Type Description
vip String Vip address of SwitchLBRule
namespace String SwitchLBRule's namespace
selector []String Standard Kubernetes selector match information
sessionAffinity String Standard Kubernetes service sessionAffinity value
ports []SlrPort List of SwitchLBRule ports

For detailed configuration information of SwitchLBRule, you can refer to Customizing VPC Internal Load Balancing health check.

SlrPort
Property Name Type Description
name String Port name
port Int32 Port number
targetPort Int32 Target port of SwitchLBRule
protocol String Protocol type

SwitchLBRuleStatus

Property Name Type Description
conditions []SwitchLBRuleCondition SwitchLBRule status change information, refer to the beginning of the document for the definition of Condition
ports String Port information
service String Name of the service

Security Group and Vip

SecurityGroup

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources are kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have a value of SecurityGroup
metadata ObjectMeta Standard Kubernetes resource metadata information
spec SecurityGroupSpec Security Group specific configuration information
status SecurityGroupStatus Security group status information

SecurityGroupSpec

Property Name Type Description
ingressRules []*SgRule Inbound security group rules
egressRules []*SgRule Outbound security group rules
allowSameGroupTraffic Bool Whether lsps in the same security group can interoperate and whether traffic rules need to be updated
SgRule
Property Name Type Description
ipVersion String IP version number, ipv4 or ipv6
protocol String The value of icmp, tcp, or udp
priority Int Acl priority. The value range is 1-200, the smaller the value, the higher the priority.
remoteType String The value is either address or securityGroup
remoteAddress String The address of the other side
remoteSecurityGroup String The name of security group on the other side
portRangeMin Int The starting value of the port range, the minimum value is 1.
portRangeMax Int The ending value of the port range, the maximum value is 65535.
policy String The value is allow or drop

SecurityGroupStatus

Property Name Type Description
portGroup String The name of the port-group for the security group
allowSameGroupTraffic Bool Whether lsps in the same security group can interoperate, and whether the security group traffic rules need to be updated
ingressMd5 String The MD5 value of the inbound security group rule
egressMd5 String The MD5 value of the outbound security group rule
ingressLastSyncSuccess Bool Whether the last synchronization of the inbound rule was successful
egressLastSyncSuccess Bool Whether the last synchronization of the outbound rule was successful

Vip

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources are kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value Vip
metadata ObjectMeta Standard Kubernetes resource metadata information
spec VipSpec Vip specific configuration information
status VipStatus Vip status information

VipSpec

Property Name Type Description
namespace String Vip's namespace
subnet String Vip's subnet
v4ip String Vip IPv4 ip address
v6ip String Vip IPv6 ip address
macAddress String Vip mac address
parentV4ip String Not currently in use
parentV6ip String Not currently in use
parentMac String Not currently in use
attachSubnets []String This field is deprecated and no longer used

VipStatus

Property Name Type Description
conditions []VipCondition Vip status change information, refer to the beginning of the documentation for the definition of Condition
ready Bool Vip is ready or not
v4ip String Vip IPv4 ip address, should be the same as the spec field
v6ip String Vip IPv6 ip address, should be the same as the spec field
mac String The vip mac address, which should be the same as the spec field
pv4ip String Not currently used
pv6ip String Not currently used
pmac String Not currently used

OvnEip

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources are kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value OvnEip
metadata ObjectMeta Standard Kubernetes resource metadata information
spec OvnEipSpec OvnEip specific configuration information for default vpc
status OvnEipStatus OvnEip status information for default vpc

OvnEipSpec

Property Name Type Description
externalSubnet String OvnEip's subnet name
v4ip String OvnEip IP address
macAddress String OvnEip Mac address
type String OvnEip use type, the value can be fip, snat or lrp

OvnEipStatus

Property Name Type Description
conditions []OvnEipCondition OvnEip status change information, refer to the beginning of the documentation for the definition of Condition
v4ip String The IPv4 ip address used by ovnEip
macAddress String Mac address used by ovnEip

OvnFip

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources are kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value OvnFip
metadata ObjectMeta Standard Kubernetes resource metadata information
spec OvnFipSpec OvnFip specific configuration information in default vpc
status OvnFipStatus OvnFip status information in default vpc

OvnFipSpec

Property Name Type Description
ovnEip String Name of the bound ovnEip
ipName String The IP crd name corresponding to the bound Pod

OvnFipStatus

Property Name Type Description
ready Bool OvnFip is ready or not
v4Eip String Name of the ovnEip to which ovnFip is bound
v4Ip String The ovnEip address currently in use
macAddress String OvnFip's configured mac address
vpc String The name of the vpc where ovnFip is located
conditions []OvnFipCondition OvnFip status change information, refer to the beginning of the document for the definition of Condition

OvnSnatRule

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value OvnSnatRule
metadata ObjectMeta Standard Kubernetes resource metadata information
spec OvnSnatRuleSpec OvnSnatRule specific configuration information in default vpc
status OvnSnatRuleStatus OvnSnatRule status information in default vpc

OvnSnatRuleSpec

Property Name Type Description
ovnEip String Name of the ovnEip to which ovnSnatRule is bound
vpcSubnet String The name of the subnet configured by ovnSnatRule
ipName String The IP crd name corresponding to the ovnSnatRule bound Pod

OvnSnatRuleStatus

Property Name Type Description
ready Bool OvnSnatRule is ready or not
v4Eip String The ovnEip address to which ovnSnatRule is bound
v4IpCidr String The cidr address used to configure snat in the logical-router
vpc String The name of the vpc where ovnSnatRule is located
conditions []OvnSnatRuleCondition OvnSnatRule status change information, refer to the beginning of the document for the definition of Condition

微信群 Slack Twitter Support


Last update: October 25, 2023
Created: February 16, 2023

Comments

Kube-OVN API Reference

Based on Kube-OVN v1.12.0, we have compiled a list of CRD resources supported by Kube-OVN, listing the types and meanings of each field of CRD definition for reference.

Generic Condition Definition

Property Name Type Description
type String Type of status
status String The value of status, in the range of True, False or Unknown
reason String The reason for the status change
message String The specific message of the status change
lastUpdateTime Time The last time the status was updated
lastTransitionTime Time Time of last status type change

In each CRD definition, the Condition field in Status follows the above format, so we explain it in advance.

Subnet Definition

Subnet

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have this value as kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value Subnet
metadata ObjectMeta Standard Kubernetes resource metadata information
spec SubnetSpec Subnet specific configuration information
status SubnetStatus Subnet status information

SubnetSpec

Property Name Type Description
default Bool Whether this subnet is the default subnet
vpc String The vpc which the subnet belongs to, default is ovn-cluster
protocol String IP protocol, the value is in the range of IPv4, IPv6 or Dual
namespaces []String The list of namespaces bound to this subnet
cidrBlock String The range of the subnet, e.g. 10.16.0.0/16
gateway String The gateway address of the subnet, the default value is the first available address under the CIDRBlock of the subnet
excludeIps []String The range of addresses under this subnet that will not be automatically assigned
provider String Default value is ovn. In the case of multiple NICs, the value is <name>.<namespace> of the NetworkAttachmentDefinition, Kube-OVN will use this information to find the corresponding subnet resource
gatewayType String The gateway type in overlay mode, either distributed or centralized
gatewayNode String The gateway node when the gateway mode is centralized, node names can be comma-separated
natOutgoing Bool Whether the outgoing traffic is NAT
externalEgressGateway String The address of the external gateway. This parameter and the natOutgoing parameter cannot be set at the same time
policyRoutingPriority Uint32 Policy route priority. Used to control the forwarding of traffic to the external gateway address after the subnet gateway
policyRoutingTableID Uint32 The TableID of the local policy routing table, should be different for each subnet to avoid conflicts
private Bool Whether the subnet is a private subnet, which denies access to addresses inside the subnet if the subnet is private
allowSubnets []String If the subnet is a private subnet, the set of addresses that are allowed to access the subnet
vlan String The name of vlan to which the subnet is bound
vips []String The virtual-ip parameter information for virtual type lsp on the subnet
logicalGateway Bool Whether to enable logical gateway
disableGatewayCheck Bool Whether to skip the gateway connectivity check when creating a pod
disableInterConnection Bool Whether to enable subnet interconnection across clusters
enableDHCP Bool Whether to configure dhcp configuration options for lsps belong this subnet
dhcpV4Options String The DHCP_Options record associated with lsp dhcpv4_options on the subnet
dhcpV6Options String The DHCP_Options record associated with lsp dhcpv6_options on the subnet
enableIPv6RA Bool Whether to configure the ipv6_ra_configs parameter for the lrp port of the router connected to the subnet
ipv6RAConfigs String The ipv6_ra_configs parameter configuration for the lrp port of the router connected to the subnet
acls []Acl The acls record associated with the logical-switch of the subnet
u2oInterconnection Bool Whether to enable interconnection mode for Overlay/Underlay
enableLb *Bool Whether the logical-switch of the subnet is associated with load-balancer records
enableEcmp Bool Centralized subnet, whether to enable ECMP routing
Acl
Property Name Type Description
direction String Restrict the direction of acl, which value is from-lport or to-lport
priority Int Acl priority, in the range 0 to 32767
match String Acl rule match expression
action String The action of the rule, which value is in the range of allow-related, allow-stateless, allow, drop, reject

SubnetStatus

Property Name Type Description
conditions []SubnetCondition Subnet status change information, refer to the beginning of the document for the definition of Condition
v4AvailableIPs Float64 Number of available IPv4 IPs
v4availableIPrange String The available range of IPv4 addresses on the subnet
v4UsingIPs Float64 Number of used IPv4 IPs
v4usingIPrange String Used IPv4 address ranges on the subnet
v6AvailableIPs Float64 Number of available IPv6 IPs
v6availableIPrange String The available range of IPv6 addresses on the subnet
v6UsingIPs Float64 Number of used IPv6 IPs
v6usingIPrange String Used IPv6 address ranges on the subnet
sctivateGateway String The currently working gateway node in centralized subnet of master-backup mode
dhcpV4OptionsUUID String The DHCP_Options record identifier associated with the lsp dhcpv4_options on the subnet
dhcpV6OptionsUUID String The DHCP_Options record identifier associated with the lsp dhcpv6_options on the subnet
u2oInterconnectionIP String The IP address used for interconnection when Overlay/Underlay interconnection mode is enabled

IP Definition

IP

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources are kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource have the value IP
metadata ObjectMeta Standard Kubernetes resource metadata information
spec IPSpec IP specific configuration information

IPSepc

Property Name Type Description
podName String Pod name which assigned with this IP
namespace String The name of the namespace where the pod is bound
subnet String The subnet which the ip belongs to
attachSubnets []String The name of the other subnets attached to this primary IP (field deprecated)
nodeName String The name of the node where the pod is bound
ipAddress String IP address, in v4IP,v6IP format for dual-stack cases
v4IPAddress String IPv4 IP address
v6IPAddress String IPv6 IP address
attachIPs []String Other IP addresses attached to this primary IP (field is deprecated)
macAddress String The Mac address of the bound pod
attachMacs []String Other Mac addresses attached to this primary IP (field deprecated)
containerID String The Container ID corresponding to the bound pod
podType String Special workload pod, can be StatefulSet, VirtualMachine or empty

Underlay configuration

Vlan

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all instances of this resource will be kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value Vlan
metadata ObjectMeta Standard Kubernetes resource metadata information
spec VlanSpec Vlan specific configuration information
status VlanStatus Vlan status information

VlanSpec

Property Name Type Description
id Int Vlan tag number, in the range of 0~4096
provider String The name of the ProviderNetwork to which the vlan is bound

VlanStatus

Property Name Type Description
subnets []String The list of subnets to which the vlan is bound
conditions []VlanCondition Vlan status change information, refer to the beginning of the document for the definition of Condition

ProviderNetwork

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources are kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value ProviderNetwork
metadata ObjectMeta Standard Kubernetes resource metadata information
spec ProviderNetworkSpec ProviderNetwork specific configuration information
status ProviderNetworkStatus ProviderNetwork status information

ProviderNetworkSpec

Property Name Type Description
defaultInterface String The name of the NIC interface used by default for this bridge network
customInterfaces []CustomInterface The special NIC configuration used by this bridge network
excludeNodes []String The names of the nodes that will not be bound to this bridge network
exchangeLinkName Bool Whether to exchange the bridge NIC and the corresponding OVS bridge name
CustomInterface
Property Name Type Description
interface String NIC interface name used for underlay
nodes []String List of nodes using the custom NIC interface

ProviderNetworkStatus

Property Name Type Description
ready Bool Whether the current bridge network is in the ready state
readyNodes []String The name of the node whose bridge network is ready
notReadyNodes []String The name of the node whose bridge network is not ready
vlans []String The name of the vlan to which the bridge network is bound
conditions []ProviderNetworkCondition ProviderNetwork status change information, refer to the beginning of the document for the definition of Condition

Vpc Definition

Vpc

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have this value as kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value Vpc
metadata ObjectMeta Standard Kubernetes resource metadata information
spec VpcSpec Vpc specific configuration information
status VpcStatus Vpc status information

VpcSpec

Property Name Type Description
namespaces []String List of namespaces bound by Vpc
staticRoutes []*StaticRoute The static route information configured under Vpc
policyRoutes []*PolicyRoute The policy route information configured under Vpc
vpcPeerings []*VpcPeering Vpc interconnection information
enableExternal Bool Whether vpc is connected to an external switch
StaticRoute
Property Name Type Description
policy String Routing policy, takes the value of policySrc or policyDst
cidr String Routing cidr value
nextHopIP String The next hop information of the route
PolicyRoute
Property Name Type Description
priority Int32 Priority for policy route
match String Match expression for policy route
action String Action for policy route, the value is in the range of allow, drop, reroute
nextHopIP String The next hop of the policy route, separated by commas in the case of ECMP routing
VpcPeering
Property Name Type Description
remoteVpc String Name of the interconnected peering vpc
localConnectIP String The local ip for vpc used to connect to peer vpc

VpcStatus

Property Name Type Description
conditions []VpcCondition Vpc status change information, refer to the beginning of the documentation for the definition of Condition
standby Bool Whether the vpc creation is complete, the subnet under the vpc needs to wait for the vpc creation to complete other proceeding
default Bool Whether it is the default vpc
defaultLogicalSwitch String The default subnet under vpc
router String The logical-router name for the vpc
tcpLoadBalancer String TCP LB information for vpc
udpLoadBalancer String UDP LB information for vpc
tcpSessionLoadBalancer String TCP Session Hold LB Information for Vpc
udpSessionLoadBalancer String UDP session hold LB information for Vpc
subnets []String List of subnets for vpc
vpcPeerings []String List of peer vpcs for vpc interconnection
enableExternal Bool Whether the vpc is connected to an external switch

VpcNatGateway

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources are kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value VpcNatGateway
metadata ObjectMeta Standard Kubernetes resource metadata information
spec VpcNatSpec Vpc gateway specific configuration information

VpcNatSpec

Property Name Type Description
vpc String Vpc name which the vpc gateway belongs to
subnet String The name of the subnet to which the gateway pod belongs
lanIp String The IP address assigned to the gateway pod
selector []String Standard Kubernetes selector match information
tolerations []VpcNatToleration Standard Kubernetes tolerance information
VpcNatToleration
Property Name Type Description
key String The key information of the taint tolerance
operator String Takes the value of Exists or Equal
value String The value information of the taint tolerance
effect String The effect of the taint tolerance, takes the value of NoExecute, NoSchedule, or PreferNoSchedule
tolerationSeconds Int64 The amount of time the pod can continue to run on the node after the taint is added

The meaning of the above tolerance fields can be found in the official Kubernetes documentation Taint and Tolerance.

IptablesEIP

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have this value as kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource have the value IptablesEIP
metadata ObjectMeta Standard Kubernetes resource metadata information
spec IptablesEipSpec IptablesEIP specific configuration information used by vpc gateway
status IptablesEipStatus IptablesEIP status information used by vpc gateway

IptablesEipSpec

Property Name Type Description
v4ip String IptablesEIP v4 address
v6ip String IptablesEIP v6 address
macAddress String The assigned mac address, not actually used
natGwDp String Vpc gateway name

IptablesEipStatus

Property Name Type Description
ready Bool Whether IptablesEIP is configured complete
ip String The IP address used by IptablesEIP, currently only IPv4 addresses are supported
redo String IptablesEIP crd creation or update time
nat String The type of IptablesEIP, either fip, snat, or dnat
conditions []IptablesEIPCondition IptablesEIP status change information, refer to the beginning of the documentation for the definition of Condition

IptablesFIPRule

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have this value as kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource have the value IptablesFIPRule
metadata ObjectMeta Standard Kubernetes resource metadata information
spec IptablesFIPRuleSpec The IptablesFIPRule specific configuration information used by vpc gateway
status IptablesFIPRuleStatus IptablesFIPRule status information used by vpc gateway

IptablesFIPRuleSpec

Property Name Type Description
eip String Name of the IptablesEIP used for IptablesFIPRule
internalIp String The corresponding internal IP address

IptablesFIPRuleStatus

Property Name Type Description
ready Bool Whether IptablesFIPRule is configured or not
v4ip String The v4 IP address used by IptablesEIP
v6ip String The v6 IP address used by IptablesEIP
natGwDp String Vpc gateway name
redo String IptablesFIPRule crd creation or update time
conditions []IptablesFIPRuleCondition IptablesFIPRule status change information, refer to the beginning of the documentation for the definition of Condition

IptablesSnatRule

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have this value as kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource have the value IptablesSnatRule
metadata ObjectMeta Standard Kubernetes resource metadata information
spec IptablesSnatRuleSpec The IptablesSnatRule specific configuration information used by the vpc gateway
status IptablesSnatRuleStatus IptablesSnatRule status information used by vpc gateway

IptablesSnatRuleSpec

Property Name Type Description
eip String Name of the IptablesEIP used by IptablesSnatRule
internalIp String IptablesSnatRule's corresponding internal IP address

IptablesSnatRuleStatus

Property Name Type Description
ready Bool Whether the configuration is complete
v4ip String The v4 IP address used by IptablesSnatRule
v6ip String The v6 IP address used by IptablesSnatRule
natGwDp String Vpc gateway name
redo String IptablesSnatRule crd creation or update time
conditions []IptablesSnatRuleCondition IptablesSnatRule status change information, refer to the beginning of the documentation for the definition of Condition

IptablesDnatRule

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have this value as kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource have the value IptablesDnatRule
metadata ObjectMeta Standard Kubernetes resource metadata information
spec IptablesDnatRuleSpec The IptablesDnatRule specific configuration information used by vpc gateway
status IptablesDnatRuleStatus IptablesDnatRule status information used by vpc gateway

IptablesDnatRuleSpec

Property Name Type Description
eip Sting Name of IptablesEIP used by IptablesDnatRule
externalPort Sting External port used by IptablesDnatRule
protocol Sting Vpc gateway dnat protocol type
internalIp Sting Internal IP address used by IptablesDnatRule
internalPort Sting Internal port used by IptablesDnatRule

IptablesDnatRuleStatus

Property Name Type Description
ready Bool Whether the configuration is complete
v4ip String The v4 IP address used by IptablesDnatRule
v6ip String The v6 IP address used by IptablesDnatRule
natGwDp String Vpc gateway name
redo String IptablesDnatRule crd creation or update time
conditions []IptablesDnatRuleCondition IptablesDnatRule Status change information, refer to the beginning of the documentation for the definition of Condition

VpcDns

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value VpcDns
metadata ObjectMeta Standard Kubernetes resource metadata information
spec VpcDnsSpec VpcDns specific configuration information
status VpcDnsStatus VpcDns status information

VpcDnsSpec

Property Name Type Description
vpc String Name of the vpc where VpcDns is located
subnet String The subnet name of the address assigned to the VpcDns pod

VpcDnsStatus

Property Name Type Description
conditions []VpcDnsCondition VpcDns status change information, refer to the beginning of the document for the definition of Condition
active Bool Whether VpcDns is in use

For detailed documentation on the use of VpcDns, see Customizing VPC DNS.

SwitchLBRule

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have this value as kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value SwitchLBRule
metadata ObjectMeta Standard Kubernetes resource metadata information
spec SwitchLBRuleSpec SwitchLBRule specific configuration information
status SwitchLBRuleStatus SwitchLBRule status information

SwitchLBRuleSpec

Property Name Type Description
vip String Vip address of SwitchLBRule
namespace String SwitchLBRule's namespace
selector []String Standard Kubernetes selector match information
sessionAffinity String Standard Kubernetes service sessionAffinity value
ports []SlrPort List of SwitchLBRule ports

For detailed configuration information of SwitchLBRule, you can refer to Customizing VPC Internal Load Balancing health check.

SlrPort
Property Name Type Description
name String Port name
port Int32 Port number
targetPort Int32 Target port of SwitchLBRule
protocol String Protocol type

SwitchLBRuleStatus

Property Name Type Description
conditions []SwitchLBRuleCondition SwitchLBRule status change information, refer to the beginning of the document for the definition of Condition
ports String Port information
service String Name of the service

Security Group and Vip

SecurityGroup

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources are kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have a value of SecurityGroup
metadata ObjectMeta Standard Kubernetes resource metadata information
spec SecurityGroupSpec Security Group specific configuration information
status SecurityGroupStatus Security group status information

SecurityGroupSpec

Property Name Type Description
ingressRules []*SgRule Inbound security group rules
egressRules []*SgRule Outbound security group rules
allowSameGroupTraffic Bool Whether lsps in the same security group can interoperate and whether traffic rules need to be updated
SgRule
Property Name Type Description
ipVersion String IP version number, ipv4 or ipv6
protocol String The value of icmp, tcp, or udp
priority Int Acl priority. The value range is 1-200, the smaller the value, the higher the priority.
remoteType String The value is either address or securityGroup
remoteAddress String The address of the other side
remoteSecurityGroup String The name of security group on the other side
portRangeMin Int The starting value of the port range, the minimum value is 1.
portRangeMax Int The ending value of the port range, the maximum value is 65535.
policy String The value is allow or drop

SecurityGroupStatus

Property Name Type Description
portGroup String The name of the port-group for the security group
allowSameGroupTraffic Bool Whether lsps in the same security group can interoperate, and whether the security group traffic rules need to be updated
ingressMd5 String The MD5 value of the inbound security group rule
egressMd5 String The MD5 value of the outbound security group rule
ingressLastSyncSuccess Bool Whether the last synchronization of the inbound rule was successful
egressLastSyncSuccess Bool Whether the last synchronization of the outbound rule was successful

Vip

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources are kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value Vip
metadata ObjectMeta Standard Kubernetes resource metadata information
spec VipSpec Vip specific configuration information
status VipStatus Vip status information

VipSpec

Property Name Type Description
namespace String Vip's namespace
subnet String Vip's subnet
type String The type of Vip, either switch_lb_vip, or empty
v4ip String Vip IPv4 ip address
v6ip String Vip IPv6 ip address
macAddress String Vip mac address
parentV4ip String Not currently in use
parentV6ip String Not currently in use
parentMac String Not currently in use
selector []String Standard Kubernetes selector match information
attachSubnets []String This field is deprecated and no longer used

VipStatus

Property Name Type Description
conditions []VipCondition Vip status change information, refer to the beginning of the documentation for the definition of Condition
ready Bool Vip is ready or not
v4ip String Vip IPv4 ip address, should be the same as the spec field
v6ip String Vip IPv6 ip address, should be the same as the spec field
mac String The vip mac address, which should be the same as the spec field
pv4ip String Not currently used
pv6ip String Not currently used
pmac String Not currently used

OvnEip

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources are kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value OvnEip
metadata ObjectMeta Standard Kubernetes resource metadata information
spec OvnEipSpec OvnEip specific configuration information for default vpc
status OvnEipStatus OvnEip status information for default vpc

OvnEipSpec

Property Name Type Description
externalSubnet String OvnEip's subnet name
v4Ip String OvnEip IPv4 address
v6Ip String OvnEip IPv6 address
macAddress String OvnEip Mac address
type String OvnEip use type, the value can be lrp, lsp or nat

OvnEipStatus

Property Name Type Description
conditions []OvnEipCondition OvnEip status change information, refer to the beginning of the documentation for the definition of Condition
type String OvnEip use type, the value can be lrp, lsp or nat
nat String dnat snat fip
v4Ip String The IPv4 ip address used by ovnEip
v6Ip String The IPv4 ip address used by ovnEip
macAddress String Mac address used by ovnEip

OvnFip

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources are kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value OvnFip
metadata ObjectMeta Standard Kubernetes resource metadata information
spec OvnFipSpec OvnFip specific configuration information in default vpc
status OvnFipStatus OvnFip status information in default vpc

OvnFipSpec

Property Name Type Description
ovnEip String Name of the bound ovnEip
ipType String vip crd or ip crd ("" means ip crd)
ipName String The IP crd name corresponding to the bound Pod
vpc String The vpc crd name corresponding to the bound Pod
V4Ip String The IPv4 ip addresss corresponding to vip or the bound Pod

OvnFipStatus

Property Name Type Description
ready Bool OvnFip is ready or not
v4Eip String Name of the ovnEip to which ovnFip is bound
v4Ip String The ovnEip address currently in use
vpc String The name of the vpc where ovnFip is located
conditions []OvnFipCondition OvnFip status change information, refer to the beginning of the document for the definition of Condition

OvnSnatRule

Property Name Type Description
apiVersion String Standard Kubernetes version information field, all custom resources have kubeovn.io/v1
kind String Standard Kubernetes resource type field, all instances of this resource will have the value OvnSnatRule
metadata ObjectMeta Standard Kubernetes resource metadata information
spec OvnSnatRuleSpec OvnSnatRule specific configuration information in default vpc
status OvnSnatRuleStatus OvnSnatRule status information in default vpc

OvnSnatRuleSpec

Property Name Type Description
ovnEip String Name of the ovnEip to which ovnSnatRule is bound
vpcSubnet String The name of the subnet of the vpc configured by ovnSnatRule
vpc String The vpc crd name corresponding to the ovnSnatRule bound Pod
ipName String The IP crd name corresponding to the ovnSnatRule bound Pod
v4IpCidr String The IPv4 cidr of the vpc subnet

OvnSnatRuleStatus

Property Name Type Description
ready Bool OvnSnatRule is ready or not
v4Eip String The ovnEip address to which ovnSnatRule is bound
v4IpCidr String The cidr address used to configure snat in the logical-router
vpc String The name of the vpc where ovnSnatRule is located
conditions []OvnSnatRuleCondition OvnSnatRule status change information, refer to the beginning of the document for the definition of Condition

微信群 Slack Twitter Support


Last update: December 22, 2023
Created: February 16, 2023

Comments

Iptables 规则

Kube-OVN 使用 ipset 及 iptables 辅助实现默认 VPC 下容器网络(Overlay)网关 NAT 的功能。

使用的 ipset 如下表所示:

名称(IPv4/IPv6) 类型 存储对象
ovn40services/ovn60services hash:net Service 网段
ovn40subnets/ovn60subnets hash:net Overlay 子网网段以及 NodeLocal DNS IP 地址
ovn40subnets-nat/ovn60subnets-nat hash:net 开启 NatOutgoing 的 Overlay 子网网段
ovn40subnets-distributed-gw/ovn60subnets-distributed-gw hash:net 开启分布式网关的 Overlay 子网网段
ovn40other-node/ovn60other-node hash:net 其它节点的内部 IP 地址
ovn40local-pod-ip-nat/ovn60local-pod-ip-nat hash:ip 已弃用
ovn40subnets-nat-policy hash:net 配置了 natOutgoingPolicyRules 的所有子网网段
ovn40natpr-418e79269dc5-dst hash:net natOutgoingPolicyRules 中 rule 对应的 dstIPs
ovn40natpr-418e79269dc5-src hash:net natOutgoingPolicyRules 中 rule 对应的 srcIPs

使用的 iptables 规则(IPv4)如下表所示:

规则 用途 备注
filter INPUT -m set --match-set ovn40services src -j ACCEPT 允许 k8s Service 和 Pod 相关流量通过 --
filter INPUT -m set --match-set ovn40services dst -j ACCEPT 同上 --
filter INPUT -m set --match-set ovn40subnets src -j ACCEPT 同上 --
filter INPUT -m set --match-set ovn40subnets dst -j ACCEPT 同上 --
filter FORWARD -m set --match-set ovn40services src -j ACCEPT 同上 --
filter FORWARD -m set --match-set ovn40services dst -j ACCEPT 同上 --
filter FORWARD -m set --match-set ovn40subnets src -j ACCEPT 同上 --
filter FORWARD -m set --match-set ovn40subnets dst -j ACCEPT 同上 --
filter FORWARD -s 10.16.0.0/16 -m comment --comment "ovn-subnet-gateway,ovn-default" 用于计数从 subnet 访问外部网络的报文 10.16.0.0/16 为 subnet 的 cidr ,comment 中逗号前面的 ovn-subnet-gateway 用于标识该 iptables 规则用于 subnet 出入网关报文计数,逗号后面 ovn-default 是该 subnet 的名字
filter FORWARD -d 10.16.0.0/16 -m comment --comment "ovn-subnet-gateway,ovn-default" 用于计数从外部网络访问 subnet 的报文 同上
filter OUTPUT -p udp -m udp --dport 6081 -j MARK --set-xmark 0x0 清除流量标记,避免执行 SNAT UDP: bad checksum on VXLAN interface
nat PREROUTING -m comment --comment "kube-ovn prerouting rules" -j OVN-PREROUTING 进入 OVN-PREROUTING 链处理 --
nat POSTROUTING -m comment --comment "kube-ovn postrouting rules" -j OVN-POSTROUTING 进入 OVN-POSTROUTING 链处理 --
nat OVN-PREROUTING -i ovn0 -m set --match-set ovn40subnets src -m set --match-set ovn40services dst -j MARK --set-xmark 0x4000/0x4000 为 Pod 访问 Service 流量添加 masquerade 标记 作用于关闭内置 LB 的场景
nat OVN-PREROUTING -p tcp -m addrtype --dst-type LOCAL -m set --match-set KUBE-NODE-PORT-LOCAL-TCP dst -j MARK --set-xmark 0x80000/0x80000 为 ExternalTrafficPolicy 为 Local 的 Service 流量(TCP)添加特定标记 仅 kube-proxy 使用 ipvs 模式时存在
nat OVN-PREROUTING -p udp -m addrtype --dst-type LOCAL -m set --match-set KUBE-NODE-PORT-LOCAL-UDP dst -j MARK --set-xmark 0x80000/0x80000 为 ExternalTrafficPolicy 为 Local 的 Service 流量(UDP)添加特定标记 同上
nat OVN-POSTROUTING -m set --match-set ovn40services src -m set --match-set ovn40subnets dst -m mark --mark 0x4000/0x4000 -j SNAT --to-source 当节点通过 Service IP 访问 Overlay Pod 时,保持源 IP 为节点 IP。 仅 kube-proxy 使用 ipvs 模式时生效
nat OVN-POSTROUTING -m mark --mark 0x4000/0x4000 -j MASQUERADE 为特定标记的流量执行 SNAT --
nat OVN-POSTROUTING -m set --match-set ovn40subnets src -m set --match-set ovn40subnets dst -j MASQUERADE 为通过节点的 Pod 之间的 Service 流量执行 SNAT --
nat OVN-POSTROUTING -m mark --mark 0x80000/0x80000 -m set --match-set ovn40subnets-distributed-gw dst -j RETURN 对于 ExternalTrafficPolicy 为 Local 的 Service 流量,若 Endpoint 使用分布式网关,无需执行 SNAT --
nat OVN-POSTROUTING -m mark --mark 0x80000/0x80000 -j MASQUERADE 对于 ExternalTrafficPolicy 为 Local 的 Service 流量,若 Endpoint 使用集中式网关,执行 SNAT --
nat OVN-POSTROUTING -p tcp -m tcp --tcp-flags SYN NONE -m conntrack --ctstate NEW -j RETURN Pod IP 对外暴露时,不执行 SNAT --
nat OVN-POSTROUTING -s 10.16.0.0/16 -m set ! --match-set ovn40subnets dst -j SNAT --to-source 192.168.0.101 Pod 访问集群外网络时,若子网开启 NatOutgoing 且使用指定 IP 的集中式网关,执行 SNAT 10.16.0.0/16 为子网网段,192.168.0.101 为指定的网关节点 IP
nat OVN-POSTROUTING -m set --match-set ovn40subnets-nat src -m set ! --match-set ovn40subnets dst -j MASQUERADE Pod 访问集群外网络时,若子网开启 NatOutgoing,执行 SNAT --
nat OVN-POSTROUTING -m set --match-set ovn40subnets-nat-policy src -m set ! --match-set ovn40subnets dst -j OVN-NAT-POLICY Pod 访问集群外网络时,若子网开启 natOutgoingPolicyRules,指定策略的报文执行 SNAT 配置了 natOutgoingPolicyRules 子网的出外网报文的进入链 OVN-NAT-POLICY
nat OVN-POSTROUTING -m mark --mark 0x90001/0x90001 -j MASQUERADE --random-fully 同上 从 OVN-NAT-POLICY 出来后,如果被打上 tag 0x90001/0x90001 就会做 SNAT
nat OVN-POSTROUTING -m mark --mark 0x90002/0x90002 -j RETURN 同上 从 OVN-NAT-POLICY 出来后, 如果被打上 tag 0x90002/0x90002 不会做 SNAT
nat OVN-NAT-POLICY -s 10.0.11.0/24 -m comment --comment natPolicySubnet-net1 -j OVN-NAT-PSUBNET-aa98851157c5 同上 10.0.11.0/24 表示子网 net1 的 CIDR, OVN-NAT-PSUBNET-aa98851157c5 这条链下的规则就对应这个子网的 natOutgoingPolicyRules 配置
nat OVN-NAT-PSUBNET-xxxxxxxxxxxx -m set --match-set ovn40natpr-418e79269dc5-src src -m set --match-set ovn40natpr-418e79269dc5-dst dst -j MARK --set-xmark 0x90002/0x90002 同上 418e79269dc5 表示 natOutgoingPolicyRules 中的一条规则的 ID,可以通过 status.natOutgoingPolicyRules[index].RuleID 查看到, 表示 srcIPs 满足 ovn40natpr-418e79269dc5-src, dstIPS 满足 ovn40natpr-418e79269dc5-dst 会打上 tag 0x90002
mangle OVN-OUTPUT -d 10.241.39.2/32 -p tcp -m tcp --dport 80 -j MARK --set-xmark 0x90003/0x90003 将 kubelet 的探测流量加上特定标记从而引入到 tproxy
mangle OVN-PREROUTING -d 10.241.39.2/32 -p tcp -m tcp --dport 80 -j TPROXY --on-port 8102 --on-ip 172.18.0.3 --tproxy-mark 0x90004/0x90004 将 kubelet 的探测流量加上特定标记从而引入到 tproxy

微信群 Slack Twitter Support


最后更新: 2023年7月13日
创建日期: 2022年9月6日

评论

Iptables 规则

Kube-OVN 使用 ipset 及 iptables 辅助实现默认 VPC 下容器网络(Overlay)网关 NAT 的功能。

使用的 ipset 如下表所示:

名称(IPv4/IPv6) 类型 存储对象
ovn40services/ovn60services hash:net Service 网段
ovn40subnets/ovn60subnets hash:net Overlay 子网网段以及 NodeLocal DNS IP 地址
ovn40subnets-nat/ovn60subnets-nat hash:net 开启 NatOutgoing 的 Overlay 子网网段
ovn40subnets-distributed-gw/ovn60subnets-distributed-gw hash:net 开启分布式网关的 Overlay 子网网段
ovn40other-node/ovn60other-node hash:net 其它节点的内部 IP 地址
ovn40local-pod-ip-nat/ovn60local-pod-ip-nat hash:ip 已弃用
ovn40subnets-nat-policy hash:net 配置了 natOutgoingPolicyRules 的所有子网网段
ovn40natpr-418e79269dc5-dst hash:net natOutgoingPolicyRules 中 rule 对应的 dstIPs
ovn40natpr-418e79269dc5-src hash:net natOutgoingPolicyRules 中 rule 对应的 srcIPs

使用的 iptables 规则(IPv4)如下表所示:

规则 用途 备注
filter INPUT -m set --match-set ovn40services src -j ACCEPT 允许 k8s Service 和 Pod 相关流量通过 --
filter INPUT -m set --match-set ovn40services dst -j ACCEPT 同上 --
filter INPUT -m set --match-set ovn40subnets src -j ACCEPT 同上 --
filter INPUT -m set --match-set ovn40subnets dst -j ACCEPT 同上 --
filter FORWARD -m set --match-set ovn40services src -j ACCEPT 同上 --
filter FORWARD -m set --match-set ovn40services dst -j ACCEPT 同上 --
filter FORWARD -m set --match-set ovn40subnets src -j ACCEPT 同上 --
filter FORWARD -m set --match-set ovn40subnets dst -j ACCEPT 同上 --
filter FORWARD -s 10.16.0.0/16 -m comment --comment "ovn-subnet-gateway,ovn-default" 用于计数从 subnet 访问外部网络的报文 10.16.0.0/16 为 subnet 的 cidr ,comment 中逗号前面的 ovn-subnet-gateway 用于标识该 iptables 规则用于 subnet 出入网关报文计数,逗号后面 ovn-default 是该 subnet 的名字
filter FORWARD -d 10.16.0.0/16 -m comment --comment "ovn-subnet-gateway,ovn-default" 用于计数从外部网络访问 subnet 的报文 同上
filter OUTPUT -p udp -m udp --dport 6081 -j MARK --set-xmark 0x0 清除流量标记,避免执行 SNAT UDP: bad checksum on VXLAN interface
nat PREROUTING -m comment --comment "kube-ovn prerouting rules" -j OVN-PREROUTING 进入 OVN-PREROUTING 链处理 --
nat POSTROUTING -m comment --comment "kube-ovn postrouting rules" -j OVN-POSTROUTING 进入 OVN-POSTROUTING 链处理 --
nat OVN-PREROUTING -i ovn0 -m set --match-set ovn40subnets src -m set --match-set ovn40services dst -j MARK --set-xmark 0x4000/0x4000 为 Pod 访问 Service 流量添加 masquerade 标记 作用于关闭内置 LB 的场景
nat OVN-PREROUTING -p tcp -m addrtype --dst-type LOCAL -m set --match-set KUBE-NODE-PORT-LOCAL-TCP dst -j MARK --set-xmark 0x80000/0x80000 为 ExternalTrafficPolicy 为 Local 的 Service 流量(TCP)添加特定标记 仅 kube-proxy 使用 ipvs 模式时存在
nat OVN-PREROUTING -p udp -m addrtype --dst-type LOCAL -m set --match-set KUBE-NODE-PORT-LOCAL-UDP dst -j MARK --set-xmark 0x80000/0x80000 为 ExternalTrafficPolicy 为 Local 的 Service 流量(UDP)添加特定标记 同上
nat OVN-POSTROUTING -m set --match-set ovn40services src -m set --match-set ovn40subnets dst -m mark --mark 0x4000/0x4000 -j SNAT --to-source 当节点通过 Service IP 访问 Overlay Pod 时,保持源 IP 为节点 IP。 仅 kube-proxy 使用 ipvs 模式时生效
nat OVN-POSTROUTING -m mark --mark 0x4000/0x4000 -j MASQUERADE 为特定标记的流量执行 SNAT --
nat OVN-POSTROUTING -m set --match-set ovn40subnets src -m set --match-set ovn40subnets dst -j MASQUERADE 为通过节点的 Pod 之间的 Service 流量执行 SNAT --
nat OVN-POSTROUTING -m mark --mark 0x80000/0x80000 -m set --match-set ovn40subnets-distributed-gw dst -j RETURN 对于 ExternalTrafficPolicy 为 Local 的 Service 流量,若 Endpoint 使用分布式网关,无需执行 SNAT --
nat OVN-POSTROUTING -m mark --mark 0x80000/0x80000 -j MASQUERADE 对于 ExternalTrafficPolicy 为 Local 的 Service 流量,若 Endpoint 使用集中式网关,执行 SNAT --
nat OVN-POSTROUTING -p tcp -m tcp --tcp-flags SYN NONE -m conntrack --ctstate NEW -j RETURN Pod IP 对外暴露时,不执行 SNAT --
nat OVN-POSTROUTING -s 10.16.0.0/16 -m set ! --match-set ovn40subnets dst -j SNAT --to-source 192.168.0.101 Pod 访问集群外网络时,若子网开启 NatOutgoing 且使用指定 IP 的集中式网关,执行 SNAT 10.16.0.0/16 为子网网段,192.168.0.101 为指定的网关节点 IP
nat OVN-POSTROUTING -m set --match-set ovn40subnets-nat src -m set ! --match-set ovn40subnets dst -j MASQUERADE Pod 访问集群外网络时,若子网开启 NatOutgoing,执行 SNAT --
nat OVN-POSTROUTING -m set --match-set ovn40subnets-nat-policy src -m set ! --match-set ovn40subnets dst -j OVN-NAT-POLICY Pod 访问集群外网络时,若子网开启 natOutgoingPolicyRules,指定策略的报文执行 SNAT 配置了 natOutgoingPolicyRules 子网的出外网报文的进入链 OVN-NAT-POLICY
nat OVN-POSTROUTING -m mark --mark 0x90001/0x90001 -j MASQUERADE --random-fully 同上 从 OVN-NAT-POLICY 出来后,如果被打上 tag 0x90001/0x90001 就会做 SNAT
nat OVN-POSTROUTING -m mark --mark 0x90002/0x90002 -j RETURN 同上 从 OVN-NAT-POLICY 出来后, 如果被打上 tag 0x90002/0x90002 不会做 SNAT
nat OVN-NAT-POLICY -s 10.0.11.0/24 -m comment --comment natPolicySubnet-net1 -j OVN-NAT-PSUBNET-aa98851157c5 同上 10.0.11.0/24 表示子网 net1 的 CIDR, OVN-NAT-PSUBNET-aa98851157c5 这条链下的规则就对应这个子网的 natOutgoingPolicyRules 配置
nat OVN-NAT-PSUBNET-xxxxxxxxxxxx -m set --match-set ovn40natpr-418e79269dc5-src src -m set --match-set ovn40natpr-418e79269dc5-dst dst -j MARK --set-xmark 0x90002/0x90002 同上 418e79269dc5 表示 natOutgoingPolicyRules 中的一条规则的 ID,可以通过 status.natOutgoingPolicyRules[index].RuleID 查看到, 表示 srcIPs 满足 ovn40natpr-418e79269dc5-src, dstIPS 满足 ovn40natpr-418e79269dc5-dst 会打上 tag 0x90002
mangle OVN-OUTPUT -d 10.241.39.2/32 -p tcp -m tcp --dport 80 -j MARK --set-xmark 0x90003/0x90003 将 kubelet 的探测流量加上特定标记从而引入到 tproxy
mangle OVN-PREROUTING -d 10.241.39.2/32 -p tcp -m tcp --dport 80 -j TPROXY --on-port 8102 --on-ip 172.18.0.3 --tproxy-mark 0x90004/0x90004 将 kubelet 的探测流量加上特定标记从而引入到 tproxy

微信群 Slack Twitter Support


最后更新: 2023年7月13日
创建日期: 2022年9月6日

评论

Kube-OVN 接口规范

基于 Kube-OVN v1.12.0 版本,整理了 Kube-OVN 支持的 CRD 资源列表,列出 CRD 定义各字段的取值类型和含义,以供参考。

通用的 Condition 定义

属性名称 类型 描述
type String 状态类型
status String 状态值,取值为 TrueFalseUnknown
reason String 状态变化的原因
message String 状态变化的具体信息
lastUpdateTime Time 上次状态更新时间
lastTransitionTime Time 上次状态类型发生变化的时间

在各 CRD 的定义中,Status 中的 Condition 字段,都遵循上述格式,因此提前进行说明。

Subnet 定义

Subnet

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 Subnet
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec SubnetSpec Subnet 具体配置信息字段
status SubnetStatus Subnet 状态信息字段

SubnetSpec

属性名称 类型 描述
default Bool 该子网是否为默认子网
vpc String 子网所属 Vpc,默认为 ovn-cluster
protocol String IP 协议,取值可以为 IPv4IPv6Dual
namespaces []String 该子网所绑定的 namespace 列表
cidrBlock String 子网的网段范围,如 10.16.0.0/16
gateway String 子网网关地址,默认为该子网 CIDRBlock 下的第一个可用地址
excludeIps []String 该子网下不会被自动分配的地址范围
provider String 默认为 ovn。多网卡情况下可以配置取值为 NetworkAttachmentDefinition 的 .,Kube-OVN 将会使用这些信息找到对应的 Subnet 资源
gatewayType String Overlay 模式下的网关类型,取值可以为 distributedcentralized
gatewayNode String 当网关模式为 centralized 时的网关节点,可以为逗号分隔的多个节点
natOutgoing Bool 出网流量是否进行 NAT。该参数和 externalEgressGateway 参数不能同时设置。
externalEgressGateway String 外部网关地址。需要和子网网关节点在同一个二层可达域,该参数和 natOutgoing 参数不能同时设置
policyRoutingPriority Uint32 策略路由优先级。添加策略路由使用参数,控制流量经子网网关之后,转发到外部网关地址
policyRoutingTableID Uint32 使用的本地策略路由表的 TableID,每个子网均需不同以避免冲突
private Bool 标识该子网是否为私有子网,私有子网默认拒绝子网外的地址访问
allowSubnets []String 子网为私有子网的情况下,允许访问该子网地址的集合
vlan String 子网绑定的 Vlan 名称
vips []String 子网下 virtual 类型 lsp 的 virtual-ip 参数信息
logicalGateway Bool 是否启用逻辑网关
disableGatewayCheck Bool 创建 Pod 时是否跳过网关联通性检查
disableInterConnection Bool 控制是否开启子网跨集群互联
enableDHCP Bool 控制是否配置子网下 lsp 的 dhcp 配置选项
dhcpV4Options String 子网下 lsp dhcpv4_options 关联的 DHCP_Options 记录
dhcpV6Options String 子网下 lsp dhcpv6_options 关联的 DHCP_Options 记录
enableIPv6RA Bool 控制子网连接路由器的 lrp 端口,是否配置 ipv6_ra_configs 参数
ipv6RAConfigs String 子网连接路由器的 lrp 端口,ipv6_ra_configs 参数配置信息
acls []Acl 子网对应 logical-switch 关联的 acls 记录
u2oInterconnection Bool 是否开启 Overlay/Underlay 的互联模式
enableLb *Bool 控制子网对应的 logical-switch 是否关联 load-balancer 记录
enableEcmp Bool 集中式网关,是否开启 ECMP 路由
Acl
属性名称 类型 描述
direction String Acl 限制方向,取值为 from-lport 或者 to-lport
priority Int Acl 优先级,取值范围 0 到 32767
match String Acl 规则匹配表达式
action String Acl 规则动作,取值为 allow-related, allow-stateless, allow, drop, reject 其中一个

SubnetStatus

属性名称 类型 描述
conditions []SubnetCondition 子网状态变化信息,具体字段参考文档开头 Condition 定义
v4AvailableIPs Float64 子网现在可用的 IPv4 IP 地址数量
v4availableIPrange String 子网现在可用的 IPv4 地址范围
v4UsingIPs Float64 子网现在已用的 IPv4 IP 地址数量
v4usingIPrange String 子网现在已用的 IPv4 地址范围
v6AvailableIPs Float64 子网现在可用的 IPv6 IP 地址数量
v6availableIPrange String 子网现在可用的 IPv6 地址范围
v6UsingIPs Float64 子网现在已用的 IPv6 IP 地址数量
v6usingIPrange String 子网现在已用的 IPv6 地址范围
sctivateGateway String 集中式子网,主备模式下当前正在工作的网关节点
dhcpV4OptionsUUID String 子网下 lsp dhcpv4_options 关联的 DHCP_Options 记录标识
dhcpV6OptionsUUID String 子网下 lsp dhcpv6_options 关联的 DHCP_Options 记录标识
u2oInterconnectionIP String 开启 Overlay/Underlay 互联模式后,所占用的用于互联的 IP 地址

IP 定义

IP

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IP
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IPSpec IP 具体配置信息字段

IPSepc

属性名称 类型 描述
podName String 绑定 Pod 名称
namespace String 绑定 Pod 所在 Namespace 名称
subnet String IP 所属 Subnet
attachSubnets []String 该主 IP 下其他附属子网名称(字段废弃不再使用)
nodeName String 绑定 Pod 所在的节点名称
ipAddress String IP 地址,双栈情况下为 v4IP,v6IP 格式
v4IPAddress String IPv4 IP 地址
v6IPAddress String IPv6 IP 地址
attachIPs []String 该主 IP 下其他附属 IP 地址(字段废弃不再使用)
macAddress String 绑定 Pod 的 Mac 地址
attachMacs []String 该主 IP 下其他附属 Mac 地址(字段废弃不再使用)
containerID String 绑定 Pod 对应的 Container ID
podType String 特殊工作负载 Pod,可为 StatefulSetVirtualMachine 或空

Underlay 配置

Vlan

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 Vlan
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VlanSpec Vlan 具体配置信息字段
status VlanStatus Vlan 状态信息字段

VlanSpec

属性名称 类型 描述
id Int Vlan tag 号,取值范围为 0~4096
provider String Vlan 绑定的 ProviderNetwork 名称

VlanStatus

属性名称 类型 描述
subnets []String Vlan 绑定的子网列表
conditions []VlanCondition Vlan 状态变化信息,具体字段参考文档开头 Condition 定义

ProviderNetwork

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 ProviderNetwork
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec ProviderNetworkSpec ProviderNetwork 具体配置信息字段
status ProviderNetworkStatus ProviderNetwork 状态信息字段

ProviderNetworkSpec

属性名称 类型 描述
defaultInterface String 该桥接网络默认使用的网卡接口名称
customInterfaces []CustomInterface 该桥接网络特殊使用的网卡配置
excludeNodes []String 该桥接网络不会绑定的节点名称
exchangeLinkName Bool 是否交换桥接网卡和对应 OVS 网桥名称
CustomInterface
属性名称 类型 描述
interface String Underlay 使用网卡接口名称
nodes []String 使用自定义网卡接口的节点列表

ProviderNetworkStatus

属性名称 类型 描述
ready Bool 当前桥接网络是否进入就绪状态
readyNodes []String 桥接网络进入就绪状态的节点名称
notReadyNodes []String 桥接网络未进入就绪状态的节点名称
vlans []String 桥接网络绑定的 Vlan 名称
conditions []ProviderNetworkCondition ProviderNetwork 状态变化信息,具体字段参考文档开头 Condition 定义

Vpc 定义

Vpc

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 Vpc
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VpcSpec Vpc 具体配置信息字段
status VpcStatus Vpc 状态信息字段

VpcSpec

属性名称 类型 描述
namespaces []String Vpc 绑定的命名空间列表
staticRoutes []*StaticRoute Vpc 下配置的静态路由信息
policyRoutes []*PolicyRoute Vpc 下配置的策略路由信息
vpcPeerings []*VpcPeering Vpc 互联信息
enableExternal Bool Vpc 是否连接到外部交换机
StaticRoute
属性名称 类型 描述
policy String 路由策略,取值为 policySrc 或者 policyDst
cidr String 路由 Cidr 网段
nextHopIP String 路由下一跳信息
PolicyRoute
属性名称 类型 描述
priority Int32 策略路由优先级
match String 策略路由匹配条件
action String 策略路由动作,取值为 allowdrop 或者 reroute
nextHopIP String 策略路由下一跳信息,ECMP 路由情况下下一跳地址使用逗号隔开
VpcPeering
属性名称 类型 描述
remoteVpc String Vpc 互联对端 Vpc 名称
localConnectIP String Vpc 互联本端 IP 地址

VpcStatus

属性名称 类型 描述
conditions []VpcCondition Vpc 状态变化信息,具体字段参考文档开头 Condition 定义
standby Bool 标识 Vpc 是否创建完成,Vpc 下的 Subnet 需要等 Vpc 创建完成转换再继续处理
default Bool 是否是默认 Vpc
defaultLogicalSwitch String Vpc 下的默认子网
router String Vpc 对应的 logical-router 名称
tcpLoadBalancer String Vpc 下的 TCP LB 信息
udpLoadBalancer String Vpc 下的 UDP LB 信息
tcpSessionLoadBalancer String Vpc 下的 TCP 会话保持 LB 信息
udpSessionLoadBalancer String Vpc 下的 UDP 会话保持 LB 信息
subnets []String Vpc 下的子网列表
vpcPeerings []String Vpc 互联的对端 Vpc 列表
enableExternal Bool Vpc 是否连接到外部交换机

VpcNatGateway

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 VpcNatGateway
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VpcNatSpec Vpc 网关具体配置信息字段

VpcNatSpec

属性名称 类型 描述
vpc String Vpc 网关 Pod 所在的 Vpc 名称
subnet String Vpc 网关 Pod 所属的子网名称
lanIp String Vpc 网关 Pod 指定分配的 IP 地址
selector []String 标准 Kubernetes Selector 匹配信息
tolerations []VpcNatToleration 标准 Kubernetes 容忍信息
VpcNatToleration
属性名称 类型 描述
key String 容忍污点的 key 信息
operator String 取值为 Exists 或者 Equal
value String 容忍污点的 value 信息
effect String 容忍污点的作用效果,取值为 NoExecuteNoSchedule 或者 PreferNoSchedule
tolerationSeconds Int64 添加污点后,Pod 还能继续在节点上运行的时间

以上容忍字段的含义,可以参考 Kubernetes 官方文档 污点和容忍度

IptablesEIP

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IptablesEIP
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IptablesEipSpec Vpc 网关使用的 IptablesEIP 具体配置信息字段
status IptablesEipStatus Vpc 网关使用的 IptablesEIP 状态信息

IptablesEipSpec

属性名称 类型 描述
v4ip String IptablesEIP v4 地址
v6ip String IptablesEIP v6 地址
macAddress String IptablesEIP crd 记录分配的 mac 地址,没有实际使用
natGwDp String Vpc 网关名称

IptablesEipStatus

属性名称 类型 描述
ready Bool IptablesEIP 是否配置完成
ip String IptablesEIP 使用的 IP 地址,目前只支持了 IPv4 地址
redo String IptablesEIP crd 创建或者更新时间
nat String IptablesEIP 的使用类型,取值为 fipsnat 或者 dnat
conditions []IptablesEIPCondition IptablesEIP 状态变化信息,具体字段参考文档开头 Condition 定义

IptablesFIPRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IptablesFIPRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IptablesFIPRuleSpec Vpc 网关使用的 IptablesFIPRule 具体配置信息字段
status IptablesFIPRuleStatus Vpc 网关使用的 IptablesFIPRule 状态信息

IptablesFIPRuleSpec

属性名称 类型 描述
eip String IptablesFIPRule 使用的 IptablesEIP 名称
internalIp String IptablesFIPRule 对应的内部的 IP 地址

IptablesFIPRuleStatus

属性名称 类型 描述
ready Bool IptablesFIPRule 是否配置完成
v4ip String IptablesEIP 使用的 v4 IP 地址
v6ip String IptablesEIP 使用的 v6 IP 地址
natGwDp String Vpc 网关名称
redo String IptablesFIPRule crd 创建或者更新时间
conditions []IptablesFIPRuleCondition IptablesFIPRule 状态变化信息,具体字段参考文档开头 Condition 定义

IptablesSnatRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IptablesSnatRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IptablesSnatRuleSpec Vpc 网关使用的 IptablesSnatRule 具体配置信息字段
status IptablesSnatRuleStatus Vpc 网关使用的 IptablesSnatRule 状态信息

IptablesSnatRuleSpec

属性名称 类型 描述
eip String IptablesSnatRule 使用的 IptablesEIP 名称
internalIp String IptablesSnatRule 对应的内部的 IP 地址

IptablesSnatRuleStatus

属性名称 类型 描述
ready Bool IptablesSnatRule 是否配置完成
v4ip String IptablesSnatRule 使用的 v4 IP 地址
v6ip String IptablesSnatRule 使用的 v6 IP 地址
natGwDp String Vpc 网关名称
redo String IptablesSnatRule crd 创建或者更新时间
conditions []IptablesSnatRuleCondition IptablesSnatRule 状态变化信息,具体字段参考文档开头 Condition 定义

IptablesDnatRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IptablesDnatRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IptablesDnatRuleSpec Vpc 网关使用的 IptablesDnatRule 具体配置信息字段
status IptablesDnatRuleStatus Vpc 网关使用的 IptablesDnatRule 状态信息

IptablesDnatRuleSpec

属性名称 类型 描述
eip Sting Vpc 网关配置 IptablesDnatRule 使用的 IptablesEIP 名称
externalPort Sting Vpc 网关配置 IptablesDnatRule 使用的外部端口
protocol Sting Vpc 网关配置 IptablesDnatRule 的协议类型
internalIp Sting Vpc 网关配置 IptablesDnatRule 使用的内部 IP 地址
internalPort Sting Vpc 网关配置 IptablesDnatRule 使用的内部端口

IptablesDnatRuleStatus

属性名称 类型 描述
ready Bool IptablesDnatRule 是否配置完成
v4ip String IptablesDnatRule 使用的 v4 IP 地址
v6ip String IptablesDnatRule 使用的 v6 IP 地址
natGwDp String Vpc 网关名称
redo String IptablesDnatRule crd 创建或者更新时间
conditions []IptablesDnatRuleCondition IptablesDnatRule 状态变化信息,具体字段参考文档开头 Condition 定义

VpcDns

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 VpcDns
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VpcDnsSpec VpcDns 具体配置信息字段
status VpcDnsStatus VpcDns 状态信息

VpcDnsSpec

属性名称 类型 描述
vpc String VpcDns 所在的 Vpc 名称
subnet String VpcDns Pod 分配地址的 Subnet 名称

VpcDnsStatus

属性名称 类型 描述
conditions []VpcDnsCondition VpcDns 状态变化信息,具体字段参考文档开头 Condition 定义
active Bool VpcDns 是否正在使用

VpcDns 的详细使用文档,可以参考 自定义 VPC 内部 DNS

SwitchLBRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 SwitchLBRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec SwitchLBRuleSpec SwitchLBRule 具体配置信息字段
status SwitchLBRuleStatus SwitchLBRule 状态信息

SwitchLBRuleSpec

属性名称 类型 描述
vip String SwitchLBRule 配置的 vip 地址
namespace String SwitchLBRule 的命名空间
selector []String 标准 Kubernetes Selector 匹配信息
sessionAffinity String 标准 Kubernetes Service 中 sessionAffinity 取值
ports []SlrPort SwitchLBRule 端口列表

SwitchLBRule 的详细配置信息,可以参考 自定义 VPC 内部负载均衡

SlrPort
属性名称 类型 描述
name String 端口名称
port Int32 端口号
targetPort Int32 目标端口号
protocol String 协议类型

SwitchLBRuleStatus

属性名称 类型 描述
conditions []SwitchLBRuleCondition SwitchLBRule 状态变化信息,具体字段参考文档开头 Condition 定义
ports String SwitchLBRule 端口信息
service String SwitchLBRule 提供服务的 service 名称

安全组与 Vip

SecurityGroup

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 SecurityGroup
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec SecurityGroupSpec 安全组具体配置信息字段
status SecurityGroupStatus 安全组状态信息

SecurityGroupSpec

属性名称 类型 描述
ingressRules []*SgRule 入方向安全组规则
egressRules []*SgRule 出方向安全组规则
allowSameGroupTraffic Bool 同一安全组内的 lsp 是否可以互通,以及流量规则是否需要更新
SgRule
属性名称 类型 描述
ipVersion String IP 版本号,取值为 ipv4 或者 ipv6
protocol String 取值为 allicmptcp 或者 udp
priority Int Acl 优先级,取值范围为 1-200,数值越小,优先级越高
remoteType String 取值为 address 或者 securityGroup
remoteAddress String 对端地址
remoteSecurityGroup String 对端安全组
portRangeMin Int 端口范围起始值,最小取值为 1
portRangeMax Int 端口范围最大值,最大取值为 65535
policy String 取值为 allow 或者 drop

SecurityGroupStatus

属性名称 类型 描述
portGroup String 安全组对应的 port-group 名称
allowSameGroupTraffic Bool 同一安全组内的 lsp 是否可以互通,以及安全组的流量规则是否需要更新
ingressMd5 String 入方向安全组规则 MD5 取值
egressMd5 String 出方向安全组规则 MD5 取值
ingressLastSyncSuccess Bool 入方向规则上一次同步是否成功
egressLastSyncSuccess Bool 出方向规则上一次同步是否成功

Vip

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 Vip
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VipSpec Vip 具体配置信息字段
status VipStatus Vip 状态信息

VipSpec

属性名称 类型 描述
namespace String Vip 所在命名空间
subnet String Vip 所属子网
v4ip String Vip v4 IP 地址
v6ip String Vip v6 IP 地址
macAddress String Vip mac 地址
parentV4ip String 目前没有使用
parentV6ip String 目前没有使用
parentMac String 目前没有使用
attachSubnets []String 该字段废弃,不再使用

VipStatus

属性名称 类型 描述
conditions []VipCondition Vip 状态变化信息,具体字段参考文档开头 Condition 定义
ready Bool Vip 是否准备好
v4ip String Vip v4 IP 地址,应该和 spec 字段取值一致
v6ip String Vip v6 IP 地址,应该和 spec 字段取值一致
mac String Vip mac 地址,应该和 spec 字段取值一致
pv4ip String 目前没有使用
pv6ip String 目前没有使用
pmac String 目前没有使用

OvnEip

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 OvnEip
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec OvnEipSpec 默认 Vpc 使用 OvnEip 具体配置信息字段
status OvnEipStatus 默认 Vpc 使用 OvnEip 状态信息

OvnEipSpec

属性名称 类型 描述
externalSubnet String OvnEip 所在的子网名称
v4ip String OvnEip IP 地址
macAddress String OvnEip Mac 地址
type String OvnEip 使用类型,取值有 fipsnat 或者 lrp

OvnEipStatus

属性名称 类型 描述
conditions []OvnEipCondition 默认 Vpc OvnEip 状态变化信息,具体字段参考文档开头 Condition 定义
v4ip String OvnEip 使用的 v4 IP 地址
macAddress String OvnEip 使用的 Mac 地址

OvnFip

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 OvnFip
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec OvnFipSpec 默认 Vpc 使用 OvnFip 具体配置信息字段
status OvnFipStatus 默认 Vpc 使用 OvnFip 状态信息

OvnFipSpec

属性名称 类型 描述
ovnEip String OvnFip 绑定的 OvnEip 名称
ipName String OvnFip 绑定 Pod 对应的 IP crd 名称

OvnFipStatus

属性名称 类型 描述
ready Bool OvnFip 是否配置完成
v4Eip String OvnFip 绑定的 OvnEip 名称
v4Ip String OvnFip 当前使用的 OvnEip 地址
macAddress String OvnFip 配置的 Mac 地址
vpc String OvnFip 所在的 Vpc 名称
conditions []OvnFipCondition OvnFip 状态变化信息,具体字段参考文档开头 Condition 定义

OvnSnatRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 OvnSnatRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec OvnSnatRuleSpec 默认 Vpc OvnSnatRule 具体配置信息字段
status OvnSnatRuleStatus 默认 Vpc OvnSnatRule 状态信息

OvnSnatRuleSpec

属性名称 类型 描述
ovnEip String OvnSnatRule 绑定的 OvnEip 名称
vpcSubnet String OvnSnatRule 配置的子网名称
ipName String OvnSnatRule 绑定 Pod 对应的 IP crd 名称

OvnSnatRuleStatus

属性名称 类型 描述
ready Bool OvnSnatRule 是否配置完成
v4Eip String OvnSnatRule 绑定的 OvnEip 地址
v4IpCidr String 在 logical-router 中配置 snat 转换使用的 cidr 地址
vpc String OvnSnatRule 所在的 Vpc 名称
conditions []OvnSnatRuleCondition OvnSnatRule 状态变化信息,具体字段参考文档开头 Condition 定义

微信群 Slack Twitter Support


最后更新: 2023年10月25日
创建日期: 2023年2月16日

评论

Kube-OVN 接口规范

基于 Kube-OVN v1.12.0 版本,整理了 Kube-OVN 支持的 CRD 资源列表,列出 CRD 定义各字段的取值类型和含义,以供参考。

通用的 Condition 定义

属性名称 类型 描述
type String 状态类型
status String 状态值,取值为 TrueFalseUnknown
reason String 状态变化的原因
message String 状态变化的具体信息
lastUpdateTime Time 上次状态更新时间
lastTransitionTime Time 上次状态类型发生变化的时间

在各 CRD 的定义中,Status 中的 Condition 字段,都遵循上述格式,因此提前进行说明。

Subnet 定义

Subnet

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 Subnet
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec SubnetSpec Subnet 具体配置信息字段
status SubnetStatus Subnet 状态信息字段

SubnetSpec

属性名称 类型 描述
default Bool 该子网是否为默认子网
vpc String 子网所属 Vpc,默认为 ovn-cluster
protocol String IP 协议,取值可以为 IPv4IPv6Dual
namespaces []String 该子网所绑定的 namespace 列表
cidrBlock String 子网的网段范围,如 10.16.0.0/16
gateway String 子网网关地址,默认为该子网 CIDRBlock 下的第一个可用地址
excludeIps []String 该子网下不会被自动分配的地址范围
provider String 默认为 ovn。多网卡情况下可以配置取值为 NetworkAttachmentDefinition 的 .,Kube-OVN 将会使用这些信息找到对应的 Subnet 资源
gatewayType String Overlay 模式下的网关类型,取值可以为 distributedcentralized
gatewayNode String 当网关模式为 centralized 时的网关节点,可以为逗号分隔的多个节点
natOutgoing Bool 出网流量是否进行 NAT。该参数和 externalEgressGateway 参数不能同时设置。
externalEgressGateway String 外部网关地址。需要和子网网关节点在同一个二层可达域,该参数和 natOutgoing 参数不能同时设置
policyRoutingPriority Uint32 策略路由优先级。添加策略路由使用参数,控制流量经子网网关之后,转发到外部网关地址
policyRoutingTableID Uint32 使用的本地策略路由表的 TableID,每个子网均需不同以避免冲突
private Bool 标识该子网是否为私有子网,私有子网默认拒绝子网外的地址访问
allowSubnets []String 子网为私有子网的情况下,允许访问该子网地址的集合
vlan String 子网绑定的 Vlan 名称
vips []String 子网下 virtual 类型 lsp 的 virtual-ip 参数信息
logicalGateway Bool 是否启用逻辑网关
disableGatewayCheck Bool 创建 Pod 时是否跳过网关联通性检查
disableInterConnection Bool 控制是否开启子网跨集群互联
enableDHCP Bool 控制是否配置子网下 lsp 的 dhcp 配置选项
dhcpV4Options String 子网下 lsp dhcpv4_options 关联的 DHCP_Options 记录
dhcpV6Options String 子网下 lsp dhcpv6_options 关联的 DHCP_Options 记录
enableIPv6RA Bool 控制子网连接路由器的 lrp 端口,是否配置 ipv6_ra_configs 参数
ipv6RAConfigs String 子网连接路由器的 lrp 端口,ipv6_ra_configs 参数配置信息
acls []Acl 子网对应 logical-switch 关联的 acls 记录
u2oInterconnection Bool 是否开启 Overlay/Underlay 的互联模式
enableLb *Bool 控制子网对应的 logical-switch 是否关联 load-balancer 记录
enableEcmp Bool 集中式网关,是否开启 ECMP 路由
Acl
属性名称 类型 描述
direction String Acl 限制方向,取值为 from-lport 或者 to-lport
priority Int Acl 优先级,取值范围 0 到 32767
match String Acl 规则匹配表达式
action String Acl 规则动作,取值为 allow-related, allow-stateless, allow, drop, reject 其中一个

SubnetStatus

属性名称 类型 描述
conditions []SubnetCondition 子网状态变化信息,具体字段参考文档开头 Condition 定义
v4AvailableIPs Float64 子网现在可用的 IPv4 IP 地址数量
v4availableIPrange String 子网现在可用的 IPv4 地址范围
v4UsingIPs Float64 子网现在已用的 IPv4 IP 地址数量
v4usingIPrange String 子网现在已用的 IPv4 地址范围
v6AvailableIPs Float64 子网现在可用的 IPv6 IP 地址数量
v6availableIPrange String 子网现在可用的 IPv6 地址范围
v6UsingIPs Float64 子网现在已用的 IPv6 IP 地址数量
v6usingIPrange String 子网现在已用的 IPv6 地址范围
sctivateGateway String 集中式子网,主备模式下当前正在工作的网关节点
dhcpV4OptionsUUID String 子网下 lsp dhcpv4_options 关联的 DHCP_Options 记录标识
dhcpV6OptionsUUID String 子网下 lsp dhcpv6_options 关联的 DHCP_Options 记录标识
u2oInterconnectionIP String 开启 Overlay/Underlay 互联模式后,所占用的用于互联的 IP 地址

IP 定义

IP

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IP
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IPSpec IP 具体配置信息字段

IPSepc

属性名称 类型 描述
podName String 绑定 Pod 名称
namespace String 绑定 Pod 所在 Namespace 名称
subnet String IP 所属 Subnet
attachSubnets []String 该主 IP 下其他附属子网名称(字段废弃不再使用)
nodeName String 绑定 Pod 所在的节点名称
ipAddress String IP 地址,双栈情况下为 v4IP,v6IP 格式
v4IPAddress String IPv4 IP 地址
v6IPAddress String IPv6 IP 地址
attachIPs []String 该主 IP 下其他附属 IP 地址(字段废弃不再使用)
macAddress String 绑定 Pod 的 Mac 地址
attachMacs []String 该主 IP 下其他附属 Mac 地址(字段废弃不再使用)
containerID String 绑定 Pod 对应的 Container ID
podType String 特殊工作负载 Pod,可为 StatefulSetVirtualMachine 或空

Underlay 配置

Vlan

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 Vlan
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VlanSpec Vlan 具体配置信息字段
status VlanStatus Vlan 状态信息字段

VlanSpec

属性名称 类型 描述
id Int Vlan tag 号,取值范围为 0~4096
provider String Vlan 绑定的 ProviderNetwork 名称

VlanStatus

属性名称 类型 描述
subnets []String Vlan 绑定的子网列表
conditions []VlanCondition Vlan 状态变化信息,具体字段参考文档开头 Condition 定义

ProviderNetwork

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 ProviderNetwork
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec ProviderNetworkSpec ProviderNetwork 具体配置信息字段
status ProviderNetworkStatus ProviderNetwork 状态信息字段

ProviderNetworkSpec

属性名称 类型 描述
defaultInterface String 该桥接网络默认使用的网卡接口名称
customInterfaces []CustomInterface 该桥接网络特殊使用的网卡配置
excludeNodes []String 该桥接网络不会绑定的节点名称
exchangeLinkName Bool 是否交换桥接网卡和对应 OVS 网桥名称
CustomInterface
属性名称 类型 描述
interface String Underlay 使用网卡接口名称
nodes []String 使用自定义网卡接口的节点列表

ProviderNetworkStatus

属性名称 类型 描述
ready Bool 当前桥接网络是否进入就绪状态
readyNodes []String 桥接网络进入就绪状态的节点名称
notReadyNodes []String 桥接网络未进入就绪状态的节点名称
vlans []String 桥接网络绑定的 Vlan 名称
conditions []ProviderNetworkCondition ProviderNetwork 状态变化信息,具体字段参考文档开头 Condition 定义

Vpc 定义

Vpc

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 Vpc
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VpcSpec Vpc 具体配置信息字段
status VpcStatus Vpc 状态信息字段

VpcSpec

属性名称 类型 描述
namespaces []String Vpc 绑定的命名空间列表
staticRoutes []*StaticRoute Vpc 下配置的静态路由信息
policyRoutes []*PolicyRoute Vpc 下配置的策略路由信息
vpcPeerings []*VpcPeering Vpc 互联信息
enableExternal Bool Vpc 是否连接到外部交换机
StaticRoute
属性名称 类型 描述
policy String 路由策略,取值为 policySrc 或者 policyDst
cidr String 路由 Cidr 网段
nextHopIP String 路由下一跳信息
PolicyRoute
属性名称 类型 描述
priority Int32 策略路由优先级
match String 策略路由匹配条件
action String 策略路由动作,取值为 allowdrop 或者 reroute
nextHopIP String 策略路由下一跳信息,ECMP 路由情况下下一跳地址使用逗号隔开
VpcPeering
属性名称 类型 描述
remoteVpc String Vpc 互联对端 Vpc 名称
localConnectIP String Vpc 互联本端 IP 地址

VpcStatus

属性名称 类型 描述
conditions []VpcCondition Vpc 状态变化信息,具体字段参考文档开头 Condition 定义
standby Bool 标识 Vpc 是否创建完成,Vpc 下的 Subnet 需要等 Vpc 创建完成转换再继续处理
default Bool 是否是默认 Vpc
defaultLogicalSwitch String Vpc 下的默认子网
router String Vpc 对应的 logical-router 名称
tcpLoadBalancer String Vpc 下的 TCP LB 信息
udpLoadBalancer String Vpc 下的 UDP LB 信息
tcpSessionLoadBalancer String Vpc 下的 TCP 会话保持 LB 信息
udpSessionLoadBalancer String Vpc 下的 UDP 会话保持 LB 信息
subnets []String Vpc 下的子网列表
vpcPeerings []String Vpc 互联的对端 Vpc 列表
enableExternal Bool Vpc 是否连接到外部交换机

VpcNatGateway

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 VpcNatGateway
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VpcNatSpec Vpc 网关具体配置信息字段

VpcNatSpec

属性名称 类型 描述
vpc String Vpc 网关 Pod 所在的 Vpc 名称
subnet String Vpc 网关 Pod 所属的子网名称
lanIp String Vpc 网关 Pod 指定分配的 IP 地址
selector []String 标准 Kubernetes Selector 匹配信息
tolerations []VpcNatToleration 标准 Kubernetes 容忍信息
VpcNatToleration
属性名称 类型 描述
key String 容忍污点的 key 信息
operator String 取值为 Exists 或者 Equal
value String 容忍污点的 value 信息
effect String 容忍污点的作用效果,取值为 NoExecuteNoSchedule 或者 PreferNoSchedule
tolerationSeconds Int64 添加污点后,Pod 还能继续在节点上运行的时间

以上容忍字段的含义,可以参考 Kubernetes 官方文档 污点和容忍度

IptablesEIP

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IptablesEIP
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IptablesEipSpec Vpc 网关使用的 IptablesEIP 具体配置信息字段
status IptablesEipStatus Vpc 网关使用的 IptablesEIP 状态信息

IptablesEipSpec

属性名称 类型 描述
v4ip String IptablesEIP v4 地址
v6ip String IptablesEIP v6 地址
macAddress String IptablesEIP crd 记录分配的 mac 地址,没有实际使用
natGwDp String Vpc 网关名称

IptablesEipStatus

属性名称 类型 描述
ready Bool IptablesEIP 是否配置完成
ip String IptablesEIP 使用的 IP 地址,目前只支持了 IPv4 地址
redo String IptablesEIP crd 创建或者更新时间
nat String IptablesEIP 的使用类型,取值为 fipsnat 或者 dnat
conditions []IptablesEIPCondition IptablesEIP 状态变化信息,具体字段参考文档开头 Condition 定义

IptablesFIPRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IptablesFIPRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IptablesFIPRuleSpec Vpc 网关使用的 IptablesFIPRule 具体配置信息字段
status IptablesFIPRuleStatus Vpc 网关使用的 IptablesFIPRule 状态信息

IptablesFIPRuleSpec

属性名称 类型 描述
eip String IptablesFIPRule 使用的 IptablesEIP 名称
internalIp String IptablesFIPRule 对应的内部的 IP 地址

IptablesFIPRuleStatus

属性名称 类型 描述
ready Bool IptablesFIPRule 是否配置完成
v4ip String IptablesEIP 使用的 v4 IP 地址
v6ip String IptablesEIP 使用的 v6 IP 地址
natGwDp String Vpc 网关名称
redo String IptablesFIPRule crd 创建或者更新时间
conditions []IptablesFIPRuleCondition IptablesFIPRule 状态变化信息,具体字段参考文档开头 Condition 定义

IptablesSnatRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IptablesSnatRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IptablesSnatRuleSpec Vpc 网关使用的 IptablesSnatRule 具体配置信息字段
status IptablesSnatRuleStatus Vpc 网关使用的 IptablesSnatRule 状态信息

IptablesSnatRuleSpec

属性名称 类型 描述
eip String IptablesSnatRule 使用的 IptablesEIP 名称
internalIp String IptablesSnatRule 对应的内部的 IP 地址

IptablesSnatRuleStatus

属性名称 类型 描述
ready Bool IptablesSnatRule 是否配置完成
v4ip String IptablesSnatRule 使用的 v4 IP 地址
v6ip String IptablesSnatRule 使用的 v6 IP 地址
natGwDp String Vpc 网关名称
redo String IptablesSnatRule crd 创建或者更新时间
conditions []IptablesSnatRuleCondition IptablesSnatRule 状态变化信息,具体字段参考文档开头 Condition 定义

IptablesDnatRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IptablesDnatRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IptablesDnatRuleSpec Vpc 网关使用的 IptablesDnatRule 具体配置信息字段
status IptablesDnatRuleStatus Vpc 网关使用的 IptablesDnatRule 状态信息

IptablesDnatRuleSpec

属性名称 类型 描述
eip Sting Vpc 网关配置 IptablesDnatRule 使用的 IptablesEIP 名称
externalPort Sting Vpc 网关配置 IptablesDnatRule 使用的外部端口
protocol Sting Vpc 网关配置 IptablesDnatRule 的协议类型
internalIp Sting Vpc 网关配置 IptablesDnatRule 使用的内部 IP 地址
internalPort Sting Vpc 网关配置 IptablesDnatRule 使用的内部端口

IptablesDnatRuleStatus

属性名称 类型 描述
ready Bool IptablesDnatRule 是否配置完成
v4ip String IptablesDnatRule 使用的 v4 IP 地址
v6ip String IptablesDnatRule 使用的 v6 IP 地址
natGwDp String Vpc 网关名称
redo String IptablesDnatRule crd 创建或者更新时间
conditions []IptablesDnatRuleCondition IptablesDnatRule 状态变化信息,具体字段参考文档开头 Condition 定义

VpcDns

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 VpcDns
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VpcDnsSpec VpcDns 具体配置信息字段
status VpcDnsStatus VpcDns 状态信息

VpcDnsSpec

属性名称 类型 描述
vpc String VpcDns 所在的 Vpc 名称
subnet String VpcDns Pod 分配地址的 Subnet 名称

VpcDnsStatus

属性名称 类型 描述
conditions []VpcDnsCondition VpcDns 状态变化信息,具体字段参考文档开头 Condition 定义
active Bool VpcDns 是否正在使用

VpcDns 的详细使用文档,可以参考 自定义 VPC 内部 DNS

SwitchLBRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 SwitchLBRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec SwitchLBRuleSpec SwitchLBRule 具体配置信息字段
status SwitchLBRuleStatus SwitchLBRule 状态信息

SwitchLBRuleSpec

属性名称 类型 描述
vip String SwitchLBRule 配置的 vip 地址
namespace String SwitchLBRule 的命名空间
selector []String 标准 Kubernetes Selector 匹配信息
sessionAffinity String 标准 Kubernetes Service 中 sessionAffinity 取值
ports []SlrPort SwitchLBRule 端口列表

SwitchLBRule 的详细配置信息,可以参考 自定义 VPC 内部负载均衡

SlrPort
属性名称 类型 描述
name String 端口名称
port Int32 端口号
targetPort Int32 目标端口号
protocol String 协议类型

SwitchLBRuleStatus

属性名称 类型 描述
conditions []SwitchLBRuleCondition SwitchLBRule 状态变化信息,具体字段参考文档开头 Condition 定义
ports String SwitchLBRule 端口信息
service String SwitchLBRule 提供服务的 service 名称

安全组与 Vip

SecurityGroup

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 SecurityGroup
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec SecurityGroupSpec 安全组具体配置信息字段
status SecurityGroupStatus 安全组状态信息

SecurityGroupSpec

属性名称 类型 描述
ingressRules []*SgRule 入方向安全组规则
egressRules []*SgRule 出方向安全组规则
allowSameGroupTraffic Bool 同一安全组内的 lsp 是否可以互通,以及流量规则是否需要更新
SgRule
属性名称 类型 描述
ipVersion String IP 版本号,取值为 ipv4 或者 ipv6
protocol String 取值为 allicmptcp 或者 udp
priority Int Acl 优先级,取值范围为 1-200,数值越小,优先级越高
remoteType String 取值为 address 或者 securityGroup
remoteAddress String 对端地址
remoteSecurityGroup String 对端安全组
portRangeMin Int 端口范围起始值,最小取值为 1
portRangeMax Int 端口范围最大值,最大取值为 65535
policy String 取值为 allow 或者 drop

SecurityGroupStatus

属性名称 类型 描述
portGroup String 安全组对应的 port-group 名称
allowSameGroupTraffic Bool 同一安全组内的 lsp 是否可以互通,以及安全组的流量规则是否需要更新
ingressMd5 String 入方向安全组规则 MD5 取值
egressMd5 String 出方向安全组规则 MD5 取值
ingressLastSyncSuccess Bool 入方向规则上一次同步是否成功
egressLastSyncSuccess Bool 出方向规则上一次同步是否成功

Vip

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 Vip
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VipSpec Vip 具体配置信息字段
status VipStatus Vip 状态信息

VipSpec

属性名称 类型 描述
namespace String Vip 所在命名空间
subnet String Vip 所属子网
type String Vip 使用类型,取值为 switch_lb_vip 或空
v4ip String Vip v4 IP 地址
v6ip String Vip v6 IP 地址
macAddress String Vip mac 地址
parentV4ip String 目前没有使用
parentV6ip String 目前没有使用
parentMac String 目前没有使用
selector []String 标准 Kubernetes Selector 匹配信息
attachSubnets []String 该字段废弃,不再使用

VipStatus

属性名称 类型 描述
conditions []VipCondition Vip 状态变化信息,具体字段参考文档开头 Condition 定义
ready Bool Vip 是否准备好
v4ip String Vip v4 IP 地址,应该和 spec 字段取值一致
v6ip String Vip v6 IP 地址,应该和 spec 字段取值一致
mac String Vip mac 地址,应该和 spec 字段取值一致
pv4ip String 目前没有使用
pv6ip String 目前没有使用
pmac String 目前没有使用

OvnEip

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 OvnEip
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec OvnEipSpec 默认 Vpc 使用 OvnEip 具体配置信息字段
status OvnEipStatus 默认 Vpc 使用 OvnEip 状态信息

OvnEipSpec

属性名称 类型 描述
externalSubnet String OvnEip 所在的子网名称
v4Ip String OvnEip IPv4 地址
v6Ip String OvnEip IPv6 地址
macAddress String OvnEip Mac 地址
type String OvnEip 使用类型,取值有 lrplsp 或者 nat

OvnEipStatus

属性名称 类型 描述
conditions []OvnEipCondition 默认 Vpc OvnEip 状态变化信息,具体字段参考文档开头 Condition 定义
type String OvnEip 使用类型, 可以是 lrp, lsp or nat
nat String dnat snat fip
v4Ip String OvnEip 使用的 v4 IP 地址
v6Ip String OvnEip 使用的 v6 IP 地址
macAddress String OvnEip 使用的 Mac 地址

OvnFip

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 OvnFip
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec OvnFipSpec 默认 Vpc 使用 OvnFip 具体配置信息字段
status OvnFipStatus 默认 Vpc 使用 OvnFip 状态信息

OvnFipSpec

属性名称 类型 描述
ovnEip String OvnFip 绑定的 OvnEip 名称
ipType String vip 或者 ip crd ("" 表示 ip crd)
ipName String OvnFip 绑定 Pod 对应的 IP crd 名称
vpc String Pod 所在的 VPC 的名字
V4Ip String IP 或者 VIP 的 IPv4 地址

OvnFipStatus

属性名称 类型 描述
ready Bool OvnFip 是否配置完成
v4Eip String OvnFip 绑定的 OvnEip 名称
v4Ip String OvnFip 当前使用的 OvnEip 地址
vpc String OvnFip 所在的 Vpc 名称
conditions []OvnFipCondition OvnFip 状态变化信息,具体字段参考文档开头 Condition 定义

OvnSnatRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 OvnSnatRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec OvnSnatRuleSpec 默认 Vpc OvnSnatRule 具体配置信息字段
status OvnSnatRuleStatus 默认 Vpc OvnSnatRule 状态信息

OvnSnatRuleSpec

属性名称 类型 描述
ovnEip String OvnSnatRule 绑定的 OvnEip 名称
vpcSubnet String OvnSnatRule 配置的子网名称
vpc String Pod 所在的 VPC
ipName String OvnSnatRule 绑定 Pod 对应的 IP crd 名称
v4IpCidr String vpc subnet 的 IPv4 cidr

OvnSnatRuleStatus

属性名称 类型 描述
ready Bool OvnSnatRule 是否配置完成
v4Eip String OvnSnatRule 绑定的 OvnEip 地址
v4IpCidr String 在 logical-router 中配置 snat 转换使用的 cidr 地址
vpc String OvnSnatRule 所在的 Vpc 名称
conditions []OvnSnatRuleCondition OvnSnatRule 状态变化信息,具体字段参考文档开头 Condition 定义

微信群 Slack Twitter Support


最后更新: 2023年12月22日
创建日期: 2023年2月16日

评论

准备工作

Kube-OVN 是一个符合 CNI 规范的网络组件,其运行需要依赖 Kubernetes 环境及对应的内核网络模块。 以下是通过测试的操作系统和软件版本,环境配置和所需要开放的端口信息。

软件版本

  • Kubernetes >= 1.23。
  • Docker >= 1.12.6, Containerd >= 1.3.4。
  • 操作系统: CentOS 7/8, Ubuntu 16.04/18.04/20.04。
  • 其他 Linux 发行版,需要检查一下内核模块是否存在 geneve, openvswitch, ip_tablesiptable_nat,Kube-OVN 正常工作依赖上述模块。

注意事项

  1. 如果内核版本为 3.10.0-862 内核 netfilter 模块存在 bug 会导致 Kube-OVN 内置负载均衡器无法工作,需要对内核升级,建议使用 CentOS 官方对应版本最新内核保证系统的安全。相关内核 bug 参考 Floating IPs broken after kernel upgrade to Centos/RHEL 7.5 - DNAT not working
  2. Rocky Linux 8.6 的内核 4.18.0-372.9.1.el8.x86_64 存在 TCP 通信问题 TCP connection failed in Rocky Linux 8.6,请升级内核至 4.18.0-372.13.1.el8_6.x86_64 或更高版本。
  3. 如果内核版本为 4.4 则对应的内核 openvswitch 模块存在问题,建议升级或手动编译 openvswitch 新版本模块进行更新
  4. Geneve 隧道建立需要检查 IPv6,可通过 cat /proc/cmdline 检查内核启动参数, 相关内核 bug 请参考 Geneve tunnels don't work when ipv6 is disabled

环境配置

  • Kernel 启动需要开启 ipv6, 如果 kernel 启动参数包含 ipv6.disable=1 需要将其设置为 0。
  • kube-proxy 正常工作,Kube-OVN 可以通过 SVC IP 访问到 kube-apiserver
  • 确认 kubelet 配置参数开启了 CNI,并且配置在标准路径下, kubelet 启动时应包含如下参数 --network-plugin=cni --cni-bin-dir=/opt/cni/bin --cni-conf-dir=/etc/cni/net.d
  • 确认未安装其他网络插件,或者其他网络插件已经被清除,检查 /etc/cni/net.d/ 路径下无其他网络插件配置文件。如果之前安装过其他网络插件,建议删除后重启机器清理残留网络资源。

端口信息

组件 端口 用途
ovn-central 6641/tcp, 6642/tcp, 6643/tcp, 6644/tcp ovn-db 和 raft server 监听端口
ovs-ovn Geneve 6081/udp, STT 7471/tcp, Vxlan 4789/udp 隧道端口
kube-ovn-controller 10660/tcp 监控监听端口
kube-ovn-daemon 10665/tcp 监控监听端口
kube-ovn-monitor 10661/tcp 监控监听端口

微信群 Slack Twitter Support


最后更新: 2023年7月20日
创建日期: 2022年5月20日

评论

准备工作

Kube-OVN 是一个符合 CNI 规范的网络组件,其运行需要依赖 Kubernetes 环境及对应的内核网络模块。 以下是通过测试的操作系统和软件版本,环境配置和所需要开放的端口信息。

软件版本

  • Kubernetes >= 1.23。
  • Docker >= 1.12.6, Containerd >= 1.3.4。
  • 操作系统: CentOS 7/8, Ubuntu 16.04/18.04/20.04。
  • 其他 Linux 发行版,需要检查一下内核模块是否存在 geneve, openvswitch, ip_tablesiptable_nat,Kube-OVN 正常工作依赖上述模块。

注意事项

  1. 如果内核版本为 3.10.0-862 内核 netfilter 模块存在 bug 会导致 Kube-OVN 内置负载均衡器无法工作,需要对内核升级,建议使用 CentOS 官方对应版本最新内核保证系统的安全。相关内核 bug 参考 Floating IPs broken after kernel upgrade to Centos/RHEL 7.5 - DNAT not working
  2. Rocky Linux 8.6 的内核 4.18.0-372.9.1.el8.x86_64 存在 TCP 通信问题 TCP connection failed in Rocky Linux 8.6,请升级内核至 4.18.0-372.13.1.el8_6.x86_64 或更高版本。
  3. 如果内核版本为 4.4 则对应的内核 openvswitch 模块存在问题,建议升级或手动编译 openvswitch 新版本模块进行更新
  4. Geneve 隧道建立需要检查 IPv6,可通过 cat /proc/cmdline 检查内核启动参数, 相关内核 bug 请参考 Geneve tunnels don't work when ipv6 is disabled

环境配置

  • Kernel 启动需要开启 IPv6, 如果 kernel 启动参数包含 ipv6.disable=1 需要将其设置为 0。
  • kube-proxy 正常工作,Kube-OVN 可以通过 Service ClusterIP 访问到 kube-apiserver
  • 确认 kubelet 配置参数开启了 CNI,并且配置在标准路径下, kubelet 启动时应包含如下参数 --network-plugin=cni --cni-bin-dir=/opt/cni/bin --cni-conf-dir=/etc/cni/net.d
  • 确认未安装其他网络插件,或者其他网络插件已经被清除,检查 /etc/cni/net.d/ 路径下无其他网络插件配置文件。如果之前安装过其他网络插件,建议删除后重启机器清理残留网络资源。

端口信息

组件 端口 用途
ovn-central 6641/tcp, 6642/tcp, 6643/tcp, 6644/tcp ovn-db 和 raft server 监听端口
ovs-ovn Geneve 6081/udp, STT 7471/tcp, Vxlan 4789/udp 隧道端口
kube-ovn-controller 10660/tcp 监控监听端口
kube-ovn-daemon 10665/tcp 监控监听端口
kube-ovn-monitor 10661/tcp 监控监听端口

微信群 Slack Twitter Support


最后更新: 2023年12月25日
创建日期: 2022年5月20日

评论

Iptables 规则

Kube-OVN 使用 ipset 及 iptables 辅助实现默认 VPC 下容器网络(Overlay)网关 NAT 的功能。

使用的 ipset 如下表所示:

名称(IPv4/IPv6) 类型 存储对象
ovn40services/ovn60services hash:net Service 网段
ovn40subnets/ovn60subnets hash:net Overlay 子网网段以及 NodeLocal DNS IP 地址
ovn40subnets-nat/ovn60subnets-nat hash:net 开启 NatOutgoing 的 Overlay 子网网段
ovn40subnets-distributed-gw/ovn60subnets-distributed-gw hash:net 开启分布式网关的 Overlay 子网网段
ovn40other-node/ovn60other-node hash:net 其它节点的内部 IP 地址
ovn40local-pod-ip-nat/ovn60local-pod-ip-nat hash:ip 已弃用
ovn40subnets-nat-policy hash:net 配置了 natOutgoingPolicyRules 的所有子网网段
ovn40natpr-418e79269dc5-dst hash:net natOutgoingPolicyRules 中 rule 对应的 dstIPs
ovn40natpr-418e79269dc5-src hash:net natOutgoingPolicyRules 中 rule 对应的 srcIPs

使用的 iptables 规则(IPv4)如下表所示:

规则 用途 备注
filter INPUT -m set --match-set ovn40services src -j ACCEPT 允许 k8s Service 和 Pod 相关流量通过 --
filter INPUT -m set --match-set ovn40services dst -j ACCEPT 同上 --
filter INPUT -m set --match-set ovn40subnets src -j ACCEPT 同上 --
filter INPUT -m set --match-set ovn40subnets dst -j ACCEPT 同上 --
filter FORWARD -m set --match-set ovn40services src -j ACCEPT 同上 --
filter FORWARD -m set --match-set ovn40services dst -j ACCEPT 同上 --
filter FORWARD -m set --match-set ovn40subnets src -j ACCEPT 同上 --
filter FORWARD -m set --match-set ovn40subnets dst -j ACCEPT 同上 --
filter FORWARD -s 10.16.0.0/16 -m comment --comment "ovn-subnet-gateway,ovn-default" 用于计数从 subnet 访问外部网络的报文 10.16.0.0/16 为 subnet 的 cidr ,comment 中逗号前面的 ovn-subnet-gateway 用于标识该 iptables 规则用于 subnet 出入网关报文计数,逗号后面 ovn-default 是该 subnet 的名字
filter FORWARD -d 10.16.0.0/16 -m comment --comment "ovn-subnet-gateway,ovn-default" 用于计数从外部网络访问 subnet 的报文 同上
filter OUTPUT -p udp -m udp --dport 6081 -j MARK --set-xmark 0x0 清除流量标记,避免执行 SNAT UDP: bad checksum on VXLAN interface
nat PREROUTING -m comment --comment "kube-ovn prerouting rules" -j OVN-PREROUTING 进入 OVN-PREROUTING 链处理 --
nat POSTROUTING -m comment --comment "kube-ovn postrouting rules" -j OVN-POSTROUTING 进入 OVN-POSTROUTING 链处理 --
nat OVN-PREROUTING -i ovn0 -m set --match-set ovn40subnets src -m set --match-set ovn40services dst -j MARK --set-xmark 0x4000/0x4000 为 Pod 访问 Service 流量添加 masquerade 标记 作用于关闭内置 LB 的场景
nat OVN-PREROUTING -p tcp -m addrtype --dst-type LOCAL -m set --match-set KUBE-NODE-PORT-LOCAL-TCP dst -j MARK --set-xmark 0x80000/0x80000 为 ExternalTrafficPolicy 为 Local 的 Service 流量(TCP)添加特定标记 仅 kube-proxy 使用 ipvs 模式时存在
nat OVN-PREROUTING -p udp -m addrtype --dst-type LOCAL -m set --match-set KUBE-NODE-PORT-LOCAL-UDP dst -j MARK --set-xmark 0x80000/0x80000 为 ExternalTrafficPolicy 为 Local 的 Service 流量(UDP)添加特定标记 同上
nat OVN-POSTROUTING -m set --match-set ovn40services src -m set --match-set ovn40subnets dst -m mark --mark 0x4000/0x4000 -j SNAT --to-source 当节点通过 Service IP 访问 Overlay Pod 时,保持源 IP 为节点 IP。 仅 kube-proxy 使用 ipvs 模式时生效
nat OVN-POSTROUTING -m mark --mark 0x4000/0x4000 -j MASQUERADE 为特定标记的流量执行 SNAT --
nat OVN-POSTROUTING -m set --match-set ovn40subnets src -m set --match-set ovn40subnets dst -j MASQUERADE 为通过节点的 Pod 之间的 Service 流量执行 SNAT --
nat OVN-POSTROUTING -m mark --mark 0x80000/0x80000 -m set --match-set ovn40subnets-distributed-gw dst -j RETURN 对于 ExternalTrafficPolicy 为 Local 的 Service 流量,若 Endpoint 使用分布式网关,无需执行 SNAT --
nat OVN-POSTROUTING -m mark --mark 0x80000/0x80000 -j MASQUERADE 对于 ExternalTrafficPolicy 为 Local 的 Service 流量,若 Endpoint 使用集中式网关,执行 SNAT --
nat OVN-POSTROUTING -p tcp -m tcp --tcp-flags SYN NONE -m conntrack --ctstate NEW -j RETURN Pod IP 对外暴露时,不执行 SNAT --
nat OVN-POSTROUTING -s 10.16.0.0/16 -m set ! --match-set ovn40subnets dst -j SNAT --to-source 192.168.0.101 Pod 访问集群外网络时,若子网开启 NatOutgoing 且使用指定 IP 的集中式网关,执行 SNAT 10.16.0.0/16 为子网网段,192.168.0.101 为指定的网关节点 IP
nat OVN-POSTROUTING -m set --match-set ovn40subnets-nat src -m set ! --match-set ovn40subnets dst -j MASQUERADE Pod 访问集群外网络时,若子网开启 NatOutgoing,执行 SNAT --
nat OVN-POSTROUTING -m set --match-set ovn40subnets-nat-policy src -m set ! --match-set ovn40subnets dst -j OVN-NAT-POLICY Pod 访问集群外网络时,若子网开启 natOutgoingPolicyRules,指定策略的报文执行 SNAT 配置了 natOutgoingPolicyRules 子网的出外网报文的进入链 OVN-NAT-POLICY
nat OVN-POSTROUTING -m mark --mark 0x90001/0x90001 -j MASQUERADE --random-fully 同上 从 OVN-NAT-POLICY 出来后,如果被打上 tag 0x90001/0x90001 就会做 SNAT
nat OVN-POSTROUTING -m mark --mark 0x90002/0x90002 -j RETURN 同上 从 OVN-NAT-POLICY 出来后, 如果被打上 tag 0x90002/0x90002 不会做 SNAT
nat OVN-NAT-POLICY -s 10.0.11.0/24 -m comment --comment natPolicySubnet-net1 -j OVN-NAT-PSUBNET-aa98851157c5 同上 10.0.11.0/24 表示子网 net1 的 CIDR, OVN-NAT-PSUBNET-aa98851157c5 这条链下的规则就对应这个子网的 natOutgoingPolicyRules 配置
nat OVN-NAT-PSUBNET-xxxxxxxxxxxx -m set --match-set ovn40natpr-418e79269dc5-src src -m set --match-set ovn40natpr-418e79269dc5-dst dst -j MARK --set-xmark 0x90002/0x90002 同上 418e79269dc5 表示 natOutgoingPolicyRules 中的一条规则的 ID,可以通过 status.natOutgoingPolicyRules[index].RuleID 查看到, 表示 srcIPs 满足 ovn40natpr-418e79269dc5-src, dstIPS 满足 ovn40natpr-418e79269dc5-dst 会打上 tag 0x90002
mangle OVN-OUTPUT -d 10.241.39.2/32 -p tcp -m tcp --dport 80 -j MARK --set-xmark 0x90003/0x90003 将 kubelet 的探测流量加上特定标记从而引入到 tproxy
mangle OVN-PREROUTING -d 10.241.39.2/32 -p tcp -m tcp --dport 80 -j TPROXY --on-port 8102 --on-ip 172.18.0.3 --tproxy-mark 0x90004/0x90004 将 kubelet 的探测流量加上特定标记从而引入到 tproxy

微信群 Slack Twitter Support


最后更新: 2023年7月13日
创建日期: 2022年9月6日

评论

Iptables 规则

Kube-OVN 使用 ipset 及 iptables 辅助实现默认 VPC 下容器网络(Overlay)网关 NAT 的功能。

使用的 ipset 如下表所示:

名称(IPv4/IPv6) 类型 存储对象
ovn40services/ovn60services hash:net Service 网段
ovn40subnets/ovn60subnets hash:net Overlay 子网网段以及 NodeLocal DNS IP 地址
ovn40subnets-nat/ovn60subnets-nat hash:net 开启 NatOutgoing 的 Overlay 子网网段
ovn40subnets-distributed-gw/ovn60subnets-distributed-gw hash:net 开启分布式网关的 Overlay 子网网段
ovn40other-node/ovn60other-node hash:net 其它节点的内部 IP 地址
ovn40local-pod-ip-nat/ovn60local-pod-ip-nat hash:ip 已弃用
ovn40subnets-nat-policy hash:net 配置了 natOutgoingPolicyRules 的所有子网网段
ovn40natpr-418e79269dc5-dst hash:net natOutgoingPolicyRules 中 rule 对应的 dstIPs
ovn40natpr-418e79269dc5-src hash:net natOutgoingPolicyRules 中 rule 对应的 srcIPs

使用的 iptables 规则(IPv4)如下表所示:

规则 用途 备注
filter INPUT -m set --match-set ovn40services src -j ACCEPT 允许 k8s Service 和 Pod 相关流量通过 --
filter INPUT -m set --match-set ovn40services dst -j ACCEPT 同上 --
filter INPUT -m set --match-set ovn40subnets src -j ACCEPT 同上 --
filter INPUT -m set --match-set ovn40subnets dst -j ACCEPT 同上 --
filter FORWARD -m set --match-set ovn40services src -j ACCEPT 同上 --
filter FORWARD -m set --match-set ovn40services dst -j ACCEPT 同上 --
filter FORWARD -m set --match-set ovn40subnets src -j ACCEPT 同上 --
filter FORWARD -m set --match-set ovn40subnets dst -j ACCEPT 同上 --
filter FORWARD -s 10.16.0.0/16 -m comment --comment "ovn-subnet-gateway,ovn-default" 用于计数从 subnet 访问外部网络的报文 10.16.0.0/16 为 subnet 的 cidr ,comment 中逗号前面的 ovn-subnet-gateway 用于标识该 iptables 规则用于 subnet 出入网关报文计数,逗号后面 ovn-default 是该 subnet 的名字
filter FORWARD -d 10.16.0.0/16 -m comment --comment "ovn-subnet-gateway,ovn-default" 用于计数从外部网络访问 subnet 的报文 同上
filter OUTPUT -p udp -m udp --dport 6081 -j MARK --set-xmark 0x0 清除流量标记,避免执行 SNAT UDP: bad checksum on VXLAN interface
nat PREROUTING -m comment --comment "kube-ovn prerouting rules" -j OVN-PREROUTING 进入 OVN-PREROUTING 链处理 --
nat POSTROUTING -m comment --comment "kube-ovn postrouting rules" -j OVN-POSTROUTING 进入 OVN-POSTROUTING 链处理 --
nat OVN-PREROUTING -i ovn0 -m set --match-set ovn40subnets src -m set --match-set ovn40services dst -j MARK --set-xmark 0x4000/0x4000 为 Pod 访问 Service 流量添加 masquerade 标记 作用于关闭内置 LB 的场景
nat OVN-PREROUTING -p tcp -m addrtype --dst-type LOCAL -m set --match-set KUBE-NODE-PORT-LOCAL-TCP dst -j MARK --set-xmark 0x80000/0x80000 为 ExternalTrafficPolicy 为 Local 的 Service 流量(TCP)添加特定标记 仅 kube-proxy 使用 ipvs 模式时存在
nat OVN-PREROUTING -p udp -m addrtype --dst-type LOCAL -m set --match-set KUBE-NODE-PORT-LOCAL-UDP dst -j MARK --set-xmark 0x80000/0x80000 为 ExternalTrafficPolicy 为 Local 的 Service 流量(UDP)添加特定标记 同上
nat OVN-POSTROUTING -m set --match-set ovn40services src -m set --match-set ovn40subnets dst -m mark --mark 0x4000/0x4000 -j SNAT --to-source 当节点通过 Service IP 访问 Overlay Pod 时,保持源 IP 为节点 IP。 仅 kube-proxy 使用 ipvs 模式时生效
nat OVN-POSTROUTING -m mark --mark 0x4000/0x4000 -j MASQUERADE 为特定标记的流量执行 SNAT --
nat OVN-POSTROUTING -m set --match-set ovn40subnets src -m set --match-set ovn40subnets dst -j MASQUERADE 为通过节点的 Pod 之间的 Service 流量执行 SNAT --
nat OVN-POSTROUTING -m mark --mark 0x80000/0x80000 -m set --match-set ovn40subnets-distributed-gw dst -j RETURN 对于 ExternalTrafficPolicy 为 Local 的 Service 流量,若 Endpoint 使用分布式网关,无需执行 SNAT --
nat OVN-POSTROUTING -m mark --mark 0x80000/0x80000 -j MASQUERADE 对于 ExternalTrafficPolicy 为 Local 的 Service 流量,若 Endpoint 使用集中式网关,执行 SNAT --
nat OVN-POSTROUTING -p tcp -m tcp --tcp-flags SYN NONE -m conntrack --ctstate NEW -j RETURN Pod IP 对外暴露时,不执行 SNAT --
nat OVN-POSTROUTING -s 10.16.0.0/16 -m set ! --match-set ovn40subnets dst -j SNAT --to-source 192.168.0.101 Pod 访问集群外网络时,若子网开启 NatOutgoing 且使用指定 IP 的集中式网关,执行 SNAT 10.16.0.0/16 为子网网段,192.168.0.101 为指定的网关节点 IP
nat OVN-POSTROUTING -m set --match-set ovn40subnets-nat src -m set ! --match-set ovn40subnets dst -j MASQUERADE Pod 访问集群外网络时,若子网开启 NatOutgoing,执行 SNAT --
nat OVN-POSTROUTING -m set --match-set ovn40subnets-nat-policy src -m set ! --match-set ovn40subnets dst -j OVN-NAT-POLICY Pod 访问集群外网络时,若子网开启 natOutgoingPolicyRules,指定策略的报文执行 SNAT 配置了 natOutgoingPolicyRules 子网的出外网报文的进入链 OVN-NAT-POLICY
nat OVN-POSTROUTING -m mark --mark 0x90001/0x90001 -j MASQUERADE --random-fully 同上 从 OVN-NAT-POLICY 出来后,如果被打上 tag 0x90001/0x90001 就会做 SNAT
nat OVN-POSTROUTING -m mark --mark 0x90002/0x90002 -j RETURN 同上 从 OVN-NAT-POLICY 出来后, 如果被打上 tag 0x90002/0x90002 不会做 SNAT
nat OVN-NAT-POLICY -s 10.0.11.0/24 -m comment --comment natPolicySubnet-net1 -j OVN-NAT-PSUBNET-aa98851157c5 同上 10.0.11.0/24 表示子网 net1 的 CIDR, OVN-NAT-PSUBNET-aa98851157c5 这条链下的规则就对应这个子网的 natOutgoingPolicyRules 配置
nat OVN-NAT-PSUBNET-xxxxxxxxxxxx -m set --match-set ovn40natpr-418e79269dc5-src src -m set --match-set ovn40natpr-418e79269dc5-dst dst -j MARK --set-xmark 0x90002/0x90002 同上 418e79269dc5 表示 natOutgoingPolicyRules 中的一条规则的 ID,可以通过 status.natOutgoingPolicyRules[index].RuleID 查看到, 表示 srcIPs 满足 ovn40natpr-418e79269dc5-src, dstIPS 满足 ovn40natpr-418e79269dc5-dst 会打上 tag 0x90002
mangle OVN-OUTPUT -d 10.241.39.2/32 -p tcp -m tcp --dport 80 -j MARK --set-xmark 0x90003/0x90003 将 kubelet 的探测流量加上特定标记从而引入到 tproxy
mangle OVN-PREROUTING -d 10.241.39.2/32 -p tcp -m tcp --dport 80 -j TPROXY --on-port 8102 --on-ip 172.18.0.3 --tproxy-mark 0x90004/0x90004 将 kubelet 的探测流量加上特定标记从而引入到 tproxy

微信群 Slack Twitter Support


最后更新: 2023年7月13日
创建日期: 2022年9月6日

评论

Kube-OVN 接口规范

基于 Kube-OVN v1.12.0 版本,整理了 Kube-OVN 支持的 CRD 资源列表,列出 CRD 定义各字段的取值类型和含义,以供参考。

通用的 Condition 定义

属性名称 类型 描述
type String 状态类型
status String 状态值,取值为 TrueFalseUnknown
reason String 状态变化的原因
message String 状态变化的具体信息
lastUpdateTime Time 上次状态更新时间
lastTransitionTime Time 上次状态类型发生变化的时间

在各 CRD 的定义中,Status 中的 Condition 字段,都遵循上述格式,因此提前进行说明。

Subnet 定义

Subnet

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 Subnet
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec SubnetSpec Subnet 具体配置信息字段
status SubnetStatus Subnet 状态信息字段

SubnetSpec

属性名称 类型 描述
default Bool 该子网是否为默认子网
vpc String 子网所属 Vpc,默认为 ovn-cluster
protocol String IP 协议,取值可以为 IPv4IPv6Dual
namespaces []String 该子网所绑定的 namespace 列表
cidrBlock String 子网的网段范围,如 10.16.0.0/16
gateway String 子网网关地址,默认为该子网 CIDRBlock 下的第一个可用地址
excludeIps []String 该子网下不会被自动分配的地址范围
provider String 默认为 ovn。多网卡情况下可以配置取值为 NetworkAttachmentDefinition 的 .,Kube-OVN 将会使用这些信息找到对应的 Subnet 资源
gatewayType String Overlay 模式下的网关类型,取值可以为 distributedcentralized
gatewayNode String 当网关模式为 centralized 时的网关节点,可以为逗号分隔的多个节点
natOutgoing Bool 出网流量是否进行 NAT。该参数和 externalEgressGateway 参数不能同时设置。
externalEgressGateway String 外部网关地址。需要和子网网关节点在同一个二层可达域,该参数和 natOutgoing 参数不能同时设置
policyRoutingPriority Uint32 策略路由优先级。添加策略路由使用参数,控制流量经子网网关之后,转发到外部网关地址
policyRoutingTableID Uint32 使用的本地策略路由表的 TableID,每个子网均需不同以避免冲突
private Bool 标识该子网是否为私有子网,私有子网默认拒绝子网外的地址访问
allowSubnets []String 子网为私有子网的情况下,允许访问该子网地址的集合
vlan String 子网绑定的 Vlan 名称
vips []String 子网下 virtual 类型 lsp 的 virtual-ip 参数信息
logicalGateway Bool 是否启用逻辑网关
disableGatewayCheck Bool 创建 Pod 时是否跳过网关联通性检查
disableInterConnection Bool 控制是否开启子网跨集群互联
enableDHCP Bool 控制是否配置子网下 lsp 的 dhcp 配置选项
dhcpV4Options String 子网下 lsp dhcpv4_options 关联的 DHCP_Options 记录
dhcpV6Options String 子网下 lsp dhcpv6_options 关联的 DHCP_Options 记录
enableIPv6RA Bool 控制子网连接路由器的 lrp 端口,是否配置 ipv6_ra_configs 参数
ipv6RAConfigs String 子网连接路由器的 lrp 端口,ipv6_ra_configs 参数配置信息
acls []Acl 子网对应 logical-switch 关联的 acls 记录
u2oInterconnection Bool 是否开启 Overlay/Underlay 的互联模式
enableLb *Bool 控制子网对应的 logical-switch 是否关联 load-balancer 记录
enableEcmp Bool 集中式网关,是否开启 ECMP 路由
Acl
属性名称 类型 描述
direction String Acl 限制方向,取值为 from-lport 或者 to-lport
priority Int Acl 优先级,取值范围 0 到 32767
match String Acl 规则匹配表达式
action String Acl 规则动作,取值为 allow-related, allow-stateless, allow, drop, reject 其中一个

SubnetStatus

属性名称 类型 描述
conditions []SubnetCondition 子网状态变化信息,具体字段参考文档开头 Condition 定义
v4AvailableIPs Float64 子网现在可用的 IPv4 IP 地址数量
v4availableIPrange String 子网现在可用的 IPv4 地址范围
v4UsingIPs Float64 子网现在已用的 IPv4 IP 地址数量
v4usingIPrange String 子网现在已用的 IPv4 地址范围
v6AvailableIPs Float64 子网现在可用的 IPv6 IP 地址数量
v6availableIPrange String 子网现在可用的 IPv6 地址范围
v6UsingIPs Float64 子网现在已用的 IPv6 IP 地址数量
v6usingIPrange String 子网现在已用的 IPv6 地址范围
sctivateGateway String 集中式子网,主备模式下当前正在工作的网关节点
dhcpV4OptionsUUID String 子网下 lsp dhcpv4_options 关联的 DHCP_Options 记录标识
dhcpV6OptionsUUID String 子网下 lsp dhcpv6_options 关联的 DHCP_Options 记录标识
u2oInterconnectionIP String 开启 Overlay/Underlay 互联模式后,所占用的用于互联的 IP 地址

IP 定义

IP

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IP
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IPSpec IP 具体配置信息字段

IPSepc

属性名称 类型 描述
podName String 绑定 Pod 名称
namespace String 绑定 Pod 所在 Namespace 名称
subnet String IP 所属 Subnet
attachSubnets []String 该主 IP 下其他附属子网名称(字段废弃不再使用)
nodeName String 绑定 Pod 所在的节点名称
ipAddress String IP 地址,双栈情况下为 v4IP,v6IP 格式
v4IPAddress String IPv4 IP 地址
v6IPAddress String IPv6 IP 地址
attachIPs []String 该主 IP 下其他附属 IP 地址(字段废弃不再使用)
macAddress String 绑定 Pod 的 Mac 地址
attachMacs []String 该主 IP 下其他附属 Mac 地址(字段废弃不再使用)
containerID String 绑定 Pod 对应的 Container ID
podType String 特殊工作负载 Pod,可为 StatefulSetVirtualMachine 或空

Underlay 配置

Vlan

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 Vlan
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VlanSpec Vlan 具体配置信息字段
status VlanStatus Vlan 状态信息字段

VlanSpec

属性名称 类型 描述
id Int Vlan tag 号,取值范围为 0~4096
provider String Vlan 绑定的 ProviderNetwork 名称

VlanStatus

属性名称 类型 描述
subnets []String Vlan 绑定的子网列表
conditions []VlanCondition Vlan 状态变化信息,具体字段参考文档开头 Condition 定义

ProviderNetwork

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 ProviderNetwork
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec ProviderNetworkSpec ProviderNetwork 具体配置信息字段
status ProviderNetworkStatus ProviderNetwork 状态信息字段

ProviderNetworkSpec

属性名称 类型 描述
defaultInterface String 该桥接网络默认使用的网卡接口名称
customInterfaces []CustomInterface 该桥接网络特殊使用的网卡配置
excludeNodes []String 该桥接网络不会绑定的节点名称
exchangeLinkName Bool 是否交换桥接网卡和对应 OVS 网桥名称
CustomInterface
属性名称 类型 描述
interface String Underlay 使用网卡接口名称
nodes []String 使用自定义网卡接口的节点列表

ProviderNetworkStatus

属性名称 类型 描述
ready Bool 当前桥接网络是否进入就绪状态
readyNodes []String 桥接网络进入就绪状态的节点名称
notReadyNodes []String 桥接网络未进入就绪状态的节点名称
vlans []String 桥接网络绑定的 Vlan 名称
conditions []ProviderNetworkCondition ProviderNetwork 状态变化信息,具体字段参考文档开头 Condition 定义

Vpc 定义

Vpc

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 Vpc
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VpcSpec Vpc 具体配置信息字段
status VpcStatus Vpc 状态信息字段

VpcSpec

属性名称 类型 描述
namespaces []String Vpc 绑定的命名空间列表
staticRoutes []*StaticRoute Vpc 下配置的静态路由信息
policyRoutes []*PolicyRoute Vpc 下配置的策略路由信息
vpcPeerings []*VpcPeering Vpc 互联信息
enableExternal Bool Vpc 是否连接到外部交换机
StaticRoute
属性名称 类型 描述
policy String 路由策略,取值为 policySrc 或者 policyDst
cidr String 路由 Cidr 网段
nextHopIP String 路由下一跳信息
PolicyRoute
属性名称 类型 描述
priority Int32 策略路由优先级
match String 策略路由匹配条件
action String 策略路由动作,取值为 allowdrop 或者 reroute
nextHopIP String 策略路由下一跳信息,ECMP 路由情况下下一跳地址使用逗号隔开
VpcPeering
属性名称 类型 描述
remoteVpc String Vpc 互联对端 Vpc 名称
localConnectIP String Vpc 互联本端 IP 地址

VpcStatus

属性名称 类型 描述
conditions []VpcCondition Vpc 状态变化信息,具体字段参考文档开头 Condition 定义
standby Bool 标识 Vpc 是否创建完成,Vpc 下的 Subnet 需要等 Vpc 创建完成转换再继续处理
default Bool 是否是默认 Vpc
defaultLogicalSwitch String Vpc 下的默认子网
router String Vpc 对应的 logical-router 名称
tcpLoadBalancer String Vpc 下的 TCP LB 信息
udpLoadBalancer String Vpc 下的 UDP LB 信息
tcpSessionLoadBalancer String Vpc 下的 TCP 会话保持 LB 信息
udpSessionLoadBalancer String Vpc 下的 UDP 会话保持 LB 信息
subnets []String Vpc 下的子网列表
vpcPeerings []String Vpc 互联的对端 Vpc 列表
enableExternal Bool Vpc 是否连接到外部交换机

VpcNatGateway

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 VpcNatGateway
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VpcNatSpec Vpc 网关具体配置信息字段

VpcNatSpec

属性名称 类型 描述
vpc String Vpc 网关 Pod 所在的 Vpc 名称
subnet String Vpc 网关 Pod 所属的子网名称
lanIp String Vpc 网关 Pod 指定分配的 IP 地址
selector []String 标准 Kubernetes Selector 匹配信息
tolerations []VpcNatToleration 标准 Kubernetes 容忍信息
VpcNatToleration
属性名称 类型 描述
key String 容忍污点的 key 信息
operator String 取值为 Exists 或者 Equal
value String 容忍污点的 value 信息
effect String 容忍污点的作用效果,取值为 NoExecuteNoSchedule 或者 PreferNoSchedule
tolerationSeconds Int64 添加污点后,Pod 还能继续在节点上运行的时间

以上容忍字段的含义,可以参考 Kubernetes 官方文档 污点和容忍度

IptablesEIP

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IptablesEIP
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IptablesEipSpec Vpc 网关使用的 IptablesEIP 具体配置信息字段
status IptablesEipStatus Vpc 网关使用的 IptablesEIP 状态信息

IptablesEipSpec

属性名称 类型 描述
v4ip String IptablesEIP v4 地址
v6ip String IptablesEIP v6 地址
macAddress String IptablesEIP crd 记录分配的 mac 地址,没有实际使用
natGwDp String Vpc 网关名称

IptablesEipStatus

属性名称 类型 描述
ready Bool IptablesEIP 是否配置完成
ip String IptablesEIP 使用的 IP 地址,目前只支持了 IPv4 地址
redo String IptablesEIP crd 创建或者更新时间
nat String IptablesEIP 的使用类型,取值为 fipsnat 或者 dnat
conditions []IptablesEIPCondition IptablesEIP 状态变化信息,具体字段参考文档开头 Condition 定义

IptablesFIPRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IptablesFIPRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IptablesFIPRuleSpec Vpc 网关使用的 IptablesFIPRule 具体配置信息字段
status IptablesFIPRuleStatus Vpc 网关使用的 IptablesFIPRule 状态信息

IptablesFIPRuleSpec

属性名称 类型 描述
eip String IptablesFIPRule 使用的 IptablesEIP 名称
internalIp String IptablesFIPRule 对应的内部的 IP 地址

IptablesFIPRuleStatus

属性名称 类型 描述
ready Bool IptablesFIPRule 是否配置完成
v4ip String IptablesEIP 使用的 v4 IP 地址
v6ip String IptablesEIP 使用的 v6 IP 地址
natGwDp String Vpc 网关名称
redo String IptablesFIPRule crd 创建或者更新时间
conditions []IptablesFIPRuleCondition IptablesFIPRule 状态变化信息,具体字段参考文档开头 Condition 定义

IptablesSnatRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IptablesSnatRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IptablesSnatRuleSpec Vpc 网关使用的 IptablesSnatRule 具体配置信息字段
status IptablesSnatRuleStatus Vpc 网关使用的 IptablesSnatRule 状态信息

IptablesSnatRuleSpec

属性名称 类型 描述
eip String IptablesSnatRule 使用的 IptablesEIP 名称
internalIp String IptablesSnatRule 对应的内部的 IP 地址

IptablesSnatRuleStatus

属性名称 类型 描述
ready Bool IptablesSnatRule 是否配置完成
v4ip String IptablesSnatRule 使用的 v4 IP 地址
v6ip String IptablesSnatRule 使用的 v6 IP 地址
natGwDp String Vpc 网关名称
redo String IptablesSnatRule crd 创建或者更新时间
conditions []IptablesSnatRuleCondition IptablesSnatRule 状态变化信息,具体字段参考文档开头 Condition 定义

IptablesDnatRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IptablesDnatRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IptablesDnatRuleSpec Vpc 网关使用的 IptablesDnatRule 具体配置信息字段
status IptablesDnatRuleStatus Vpc 网关使用的 IptablesDnatRule 状态信息

IptablesDnatRuleSpec

属性名称 类型 描述
eip Sting Vpc 网关配置 IptablesDnatRule 使用的 IptablesEIP 名称
externalPort Sting Vpc 网关配置 IptablesDnatRule 使用的外部端口
protocol Sting Vpc 网关配置 IptablesDnatRule 的协议类型
internalIp Sting Vpc 网关配置 IptablesDnatRule 使用的内部 IP 地址
internalPort Sting Vpc 网关配置 IptablesDnatRule 使用的内部端口

IptablesDnatRuleStatus

属性名称 类型 描述
ready Bool IptablesDnatRule 是否配置完成
v4ip String IptablesDnatRule 使用的 v4 IP 地址
v6ip String IptablesDnatRule 使用的 v6 IP 地址
natGwDp String Vpc 网关名称
redo String IptablesDnatRule crd 创建或者更新时间
conditions []IptablesDnatRuleCondition IptablesDnatRule 状态变化信息,具体字段参考文档开头 Condition 定义

VpcDns

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 VpcDns
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VpcDnsSpec VpcDns 具体配置信息字段
status VpcDnsStatus VpcDns 状态信息

VpcDnsSpec

属性名称 类型 描述
vpc String VpcDns 所在的 Vpc 名称
subnet String VpcDns Pod 分配地址的 Subnet 名称

VpcDnsStatus

属性名称 类型 描述
conditions []VpcDnsCondition VpcDns 状态变化信息,具体字段参考文档开头 Condition 定义
active Bool VpcDns 是否正在使用

VpcDns 的详细使用文档,可以参考 自定义 VPC 内部 DNS

SwitchLBRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 SwitchLBRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec SwitchLBRuleSpec SwitchLBRule 具体配置信息字段
status SwitchLBRuleStatus SwitchLBRule 状态信息

SwitchLBRuleSpec

属性名称 类型 描述
vip String SwitchLBRule 配置的 vip 地址
namespace String SwitchLBRule 的命名空间
selector []String 标准 Kubernetes Selector 匹配信息
sessionAffinity String 标准 Kubernetes Service 中 sessionAffinity 取值
ports []SlrPort SwitchLBRule 端口列表

SwitchLBRule 的详细配置信息,可以参考 自定义 VPC 内部负载均衡

SlrPort
属性名称 类型 描述
name String 端口名称
port Int32 端口号
targetPort Int32 目标端口号
protocol String 协议类型

SwitchLBRuleStatus

属性名称 类型 描述
conditions []SwitchLBRuleCondition SwitchLBRule 状态变化信息,具体字段参考文档开头 Condition 定义
ports String SwitchLBRule 端口信息
service String SwitchLBRule 提供服务的 service 名称

安全组与 Vip

SecurityGroup

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 SecurityGroup
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec SecurityGroupSpec 安全组具体配置信息字段
status SecurityGroupStatus 安全组状态信息

SecurityGroupSpec

属性名称 类型 描述
ingressRules []*SgRule 入方向安全组规则
egressRules []*SgRule 出方向安全组规则
allowSameGroupTraffic Bool 同一安全组内的 lsp 是否可以互通,以及流量规则是否需要更新
SgRule
属性名称 类型 描述
ipVersion String IP 版本号,取值为 ipv4 或者 ipv6
protocol String 取值为 allicmptcp 或者 udp
priority Int Acl 优先级,取值范围为 1-200,数值越小,优先级越高
remoteType String 取值为 address 或者 securityGroup
remoteAddress String 对端地址
remoteSecurityGroup String 对端安全组
portRangeMin Int 端口范围起始值,最小取值为 1
portRangeMax Int 端口范围最大值,最大取值为 65535
policy String 取值为 allow 或者 drop

SecurityGroupStatus

属性名称 类型 描述
portGroup String 安全组对应的 port-group 名称
allowSameGroupTraffic Bool 同一安全组内的 lsp 是否可以互通,以及安全组的流量规则是否需要更新
ingressMd5 String 入方向安全组规则 MD5 取值
egressMd5 String 出方向安全组规则 MD5 取值
ingressLastSyncSuccess Bool 入方向规则上一次同步是否成功
egressLastSyncSuccess Bool 出方向规则上一次同步是否成功

Vip

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 Vip
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VipSpec Vip 具体配置信息字段
status VipStatus Vip 状态信息

VipSpec

属性名称 类型 描述
namespace String Vip 所在命名空间
subnet String Vip 所属子网
v4ip String Vip v4 IP 地址
v6ip String Vip v6 IP 地址
macAddress String Vip mac 地址
parentV4ip String 目前没有使用
parentV6ip String 目前没有使用
parentMac String 目前没有使用
attachSubnets []String 该字段废弃,不再使用

VipStatus

属性名称 类型 描述
conditions []VipCondition Vip 状态变化信息,具体字段参考文档开头 Condition 定义
ready Bool Vip 是否准备好
v4ip String Vip v4 IP 地址,应该和 spec 字段取值一致
v6ip String Vip v6 IP 地址,应该和 spec 字段取值一致
mac String Vip mac 地址,应该和 spec 字段取值一致
pv4ip String 目前没有使用
pv6ip String 目前没有使用
pmac String 目前没有使用

OvnEip

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 OvnEip
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec OvnEipSpec 默认 Vpc 使用 OvnEip 具体配置信息字段
status OvnEipStatus 默认 Vpc 使用 OvnEip 状态信息

OvnEipSpec

属性名称 类型 描述
externalSubnet String OvnEip 所在的子网名称
v4ip String OvnEip IP 地址
macAddress String OvnEip Mac 地址
type String OvnEip 使用类型,取值有 fipsnat 或者 lrp

OvnEipStatus

属性名称 类型 描述
conditions []OvnEipCondition 默认 Vpc OvnEip 状态变化信息,具体字段参考文档开头 Condition 定义
v4ip String OvnEip 使用的 v4 IP 地址
macAddress String OvnEip 使用的 Mac 地址

OvnFip

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 OvnFip
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec OvnFipSpec 默认 Vpc 使用 OvnFip 具体配置信息字段
status OvnFipStatus 默认 Vpc 使用 OvnFip 状态信息

OvnFipSpec

属性名称 类型 描述
ovnEip String OvnFip 绑定的 OvnEip 名称
ipName String OvnFip 绑定 Pod 对应的 IP crd 名称

OvnFipStatus

属性名称 类型 描述
ready Bool OvnFip 是否配置完成
v4Eip String OvnFip 绑定的 OvnEip 名称
v4Ip String OvnFip 当前使用的 OvnEip 地址
macAddress String OvnFip 配置的 Mac 地址
vpc String OvnFip 所在的 Vpc 名称
conditions []OvnFipCondition OvnFip 状态变化信息,具体字段参考文档开头 Condition 定义

OvnSnatRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 OvnSnatRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec OvnSnatRuleSpec 默认 Vpc OvnSnatRule 具体配置信息字段
status OvnSnatRuleStatus 默认 Vpc OvnSnatRule 状态信息

OvnSnatRuleSpec

属性名称 类型 描述
ovnEip String OvnSnatRule 绑定的 OvnEip 名称
vpcSubnet String OvnSnatRule 配置的子网名称
ipName String OvnSnatRule 绑定 Pod 对应的 IP crd 名称

OvnSnatRuleStatus

属性名称 类型 描述
ready Bool OvnSnatRule 是否配置完成
v4Eip String OvnSnatRule 绑定的 OvnEip 地址
v4IpCidr String 在 logical-router 中配置 snat 转换使用的 cidr 地址
vpc String OvnSnatRule 所在的 Vpc 名称
conditions []OvnSnatRuleCondition OvnSnatRule 状态变化信息,具体字段参考文档开头 Condition 定义

微信群 Slack Twitter Support


最后更新: 2023年10月25日
创建日期: 2023年2月16日

评论

Kube-OVN 接口规范

基于 Kube-OVN v1.12.0 版本,整理了 Kube-OVN 支持的 CRD 资源列表,列出 CRD 定义各字段的取值类型和含义,以供参考。

通用的 Condition 定义

属性名称 类型 描述
type String 状态类型
status String 状态值,取值为 TrueFalseUnknown
reason String 状态变化的原因
message String 状态变化的具体信息
lastUpdateTime Time 上次状态更新时间
lastTransitionTime Time 上次状态类型发生变化的时间

在各 CRD 的定义中,Status 中的 Condition 字段,都遵循上述格式,因此提前进行说明。

Subnet 定义

Subnet

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 Subnet
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec SubnetSpec Subnet 具体配置信息字段
status SubnetStatus Subnet 状态信息字段

SubnetSpec

属性名称 类型 描述
default Bool 该子网是否为默认子网
vpc String 子网所属 Vpc,默认为 ovn-cluster
protocol String IP 协议,取值可以为 IPv4IPv6Dual
namespaces []String 该子网所绑定的 namespace 列表
cidrBlock String 子网的网段范围,如 10.16.0.0/16
gateway String 子网网关地址,默认为该子网 CIDRBlock 下的第一个可用地址
excludeIps []String 该子网下不会被自动分配的地址范围
provider String 默认为 ovn。多网卡情况下可以配置取值为 NetworkAttachmentDefinition 的 .,Kube-OVN 将会使用这些信息找到对应的 Subnet 资源
gatewayType String Overlay 模式下的网关类型,取值可以为 distributedcentralized
gatewayNode String 当网关模式为 centralized 时的网关节点,可以为逗号分隔的多个节点
natOutgoing Bool 出网流量是否进行 NAT。该参数和 externalEgressGateway 参数不能同时设置。
externalEgressGateway String 外部网关地址。需要和子网网关节点在同一个二层可达域,该参数和 natOutgoing 参数不能同时设置
policyRoutingPriority Uint32 策略路由优先级。添加策略路由使用参数,控制流量经子网网关之后,转发到外部网关地址
policyRoutingTableID Uint32 使用的本地策略路由表的 TableID,每个子网均需不同以避免冲突
private Bool 标识该子网是否为私有子网,私有子网默认拒绝子网外的地址访问
allowSubnets []String 子网为私有子网的情况下,允许访问该子网地址的集合
vlan String 子网绑定的 Vlan 名称
vips []String 子网下 virtual 类型 lsp 的 virtual-ip 参数信息
logicalGateway Bool 是否启用逻辑网关
disableGatewayCheck Bool 创建 Pod 时是否跳过网关联通性检查
disableInterConnection Bool 控制是否开启子网跨集群互联
enableDHCP Bool 控制是否配置子网下 lsp 的 dhcp 配置选项
dhcpV4Options String 子网下 lsp dhcpv4_options 关联的 DHCP_Options 记录
dhcpV6Options String 子网下 lsp dhcpv6_options 关联的 DHCP_Options 记录
enableIPv6RA Bool 控制子网连接路由器的 lrp 端口,是否配置 ipv6_ra_configs 参数
ipv6RAConfigs String 子网连接路由器的 lrp 端口,ipv6_ra_configs 参数配置信息
acls []Acl 子网对应 logical-switch 关联的 acls 记录
u2oInterconnection Bool 是否开启 Overlay/Underlay 的互联模式
enableLb *Bool 控制子网对应的 logical-switch 是否关联 load-balancer 记录
enableEcmp Bool 集中式网关,是否开启 ECMP 路由
Acl
属性名称 类型 描述
direction String Acl 限制方向,取值为 from-lport 或者 to-lport
priority Int Acl 优先级,取值范围 0 到 32767
match String Acl 规则匹配表达式
action String Acl 规则动作,取值为 allow-related, allow-stateless, allow, drop, reject 其中一个

SubnetStatus

属性名称 类型 描述
conditions []SubnetCondition 子网状态变化信息,具体字段参考文档开头 Condition 定义
v4AvailableIPs Float64 子网现在可用的 IPv4 IP 地址数量
v4availableIPrange String 子网现在可用的 IPv4 地址范围
v4UsingIPs Float64 子网现在已用的 IPv4 IP 地址数量
v4usingIPrange String 子网现在已用的 IPv4 地址范围
v6AvailableIPs Float64 子网现在可用的 IPv6 IP 地址数量
v6availableIPrange String 子网现在可用的 IPv6 地址范围
v6UsingIPs Float64 子网现在已用的 IPv6 IP 地址数量
v6usingIPrange String 子网现在已用的 IPv6 地址范围
sctivateGateway String 集中式子网,主备模式下当前正在工作的网关节点
dhcpV4OptionsUUID String 子网下 lsp dhcpv4_options 关联的 DHCP_Options 记录标识
dhcpV6OptionsUUID String 子网下 lsp dhcpv6_options 关联的 DHCP_Options 记录标识
u2oInterconnectionIP String 开启 Overlay/Underlay 互联模式后,所占用的用于互联的 IP 地址

IP 定义

IP

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IP
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IPSpec IP 具体配置信息字段

IPSepc

属性名称 类型 描述
podName String 绑定 Pod 名称
namespace String 绑定 Pod 所在 Namespace 名称
subnet String IP 所属 Subnet
attachSubnets []String 该主 IP 下其他附属子网名称(字段废弃不再使用)
nodeName String 绑定 Pod 所在的节点名称
ipAddress String IP 地址,双栈情况下为 v4IP,v6IP 格式
v4IPAddress String IPv4 IP 地址
v6IPAddress String IPv6 IP 地址
attachIPs []String 该主 IP 下其他附属 IP 地址(字段废弃不再使用)
macAddress String 绑定 Pod 的 Mac 地址
attachMacs []String 该主 IP 下其他附属 Mac 地址(字段废弃不再使用)
containerID String 绑定 Pod 对应的 Container ID
podType String 特殊工作负载 Pod,可为 StatefulSetVirtualMachine 或空

Underlay 配置

Vlan

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 Vlan
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VlanSpec Vlan 具体配置信息字段
status VlanStatus Vlan 状态信息字段

VlanSpec

属性名称 类型 描述
id Int Vlan tag 号,取值范围为 0~4096
provider String Vlan 绑定的 ProviderNetwork 名称

VlanStatus

属性名称 类型 描述
subnets []String Vlan 绑定的子网列表
conditions []VlanCondition Vlan 状态变化信息,具体字段参考文档开头 Condition 定义

ProviderNetwork

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 ProviderNetwork
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec ProviderNetworkSpec ProviderNetwork 具体配置信息字段
status ProviderNetworkStatus ProviderNetwork 状态信息字段

ProviderNetworkSpec

属性名称 类型 描述
defaultInterface String 该桥接网络默认使用的网卡接口名称
customInterfaces []CustomInterface 该桥接网络特殊使用的网卡配置
excludeNodes []String 该桥接网络不会绑定的节点名称
exchangeLinkName Bool 是否交换桥接网卡和对应 OVS 网桥名称
CustomInterface
属性名称 类型 描述
interface String Underlay 使用网卡接口名称
nodes []String 使用自定义网卡接口的节点列表

ProviderNetworkStatus

属性名称 类型 描述
ready Bool 当前桥接网络是否进入就绪状态
readyNodes []String 桥接网络进入就绪状态的节点名称
notReadyNodes []String 桥接网络未进入就绪状态的节点名称
vlans []String 桥接网络绑定的 Vlan 名称
conditions []ProviderNetworkCondition ProviderNetwork 状态变化信息,具体字段参考文档开头 Condition 定义

Vpc 定义

Vpc

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 Vpc
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VpcSpec Vpc 具体配置信息字段
status VpcStatus Vpc 状态信息字段

VpcSpec

属性名称 类型 描述
namespaces []String Vpc 绑定的命名空间列表
staticRoutes []*StaticRoute Vpc 下配置的静态路由信息
policyRoutes []*PolicyRoute Vpc 下配置的策略路由信息
vpcPeerings []*VpcPeering Vpc 互联信息
enableExternal Bool Vpc 是否连接到外部交换机
StaticRoute
属性名称 类型 描述
policy String 路由策略,取值为 policySrc 或者 policyDst
cidr String 路由 Cidr 网段
nextHopIP String 路由下一跳信息
PolicyRoute
属性名称 类型 描述
priority Int32 策略路由优先级
match String 策略路由匹配条件
action String 策略路由动作,取值为 allowdrop 或者 reroute
nextHopIP String 策略路由下一跳信息,ECMP 路由情况下下一跳地址使用逗号隔开
VpcPeering
属性名称 类型 描述
remoteVpc String Vpc 互联对端 Vpc 名称
localConnectIP String Vpc 互联本端 IP 地址

VpcStatus

属性名称 类型 描述
conditions []VpcCondition Vpc 状态变化信息,具体字段参考文档开头 Condition 定义
standby Bool 标识 Vpc 是否创建完成,Vpc 下的 Subnet 需要等 Vpc 创建完成转换再继续处理
default Bool 是否是默认 Vpc
defaultLogicalSwitch String Vpc 下的默认子网
router String Vpc 对应的 logical-router 名称
tcpLoadBalancer String Vpc 下的 TCP LB 信息
udpLoadBalancer String Vpc 下的 UDP LB 信息
tcpSessionLoadBalancer String Vpc 下的 TCP 会话保持 LB 信息
udpSessionLoadBalancer String Vpc 下的 UDP 会话保持 LB 信息
subnets []String Vpc 下的子网列表
vpcPeerings []String Vpc 互联的对端 Vpc 列表
enableExternal Bool Vpc 是否连接到外部交换机

VpcNatGateway

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 VpcNatGateway
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VpcNatSpec Vpc 网关具体配置信息字段

VpcNatSpec

属性名称 类型 描述
vpc String Vpc 网关 Pod 所在的 Vpc 名称
subnet String Vpc 网关 Pod 所属的子网名称
lanIp String Vpc 网关 Pod 指定分配的 IP 地址
selector []String 标准 Kubernetes Selector 匹配信息
tolerations []VpcNatToleration 标准 Kubernetes 容忍信息
VpcNatToleration
属性名称 类型 描述
key String 容忍污点的 key 信息
operator String 取值为 Exists 或者 Equal
value String 容忍污点的 value 信息
effect String 容忍污点的作用效果,取值为 NoExecuteNoSchedule 或者 PreferNoSchedule
tolerationSeconds Int64 添加污点后,Pod 还能继续在节点上运行的时间

以上容忍字段的含义,可以参考 Kubernetes 官方文档 污点和容忍度

IptablesEIP

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IptablesEIP
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IptablesEipSpec Vpc 网关使用的 IptablesEIP 具体配置信息字段
status IptablesEipStatus Vpc 网关使用的 IptablesEIP 状态信息

IptablesEipSpec

属性名称 类型 描述
v4ip String IptablesEIP v4 地址
v6ip String IptablesEIP v6 地址
macAddress String IptablesEIP crd 记录分配的 mac 地址,没有实际使用
natGwDp String Vpc 网关名称

IptablesEipStatus

属性名称 类型 描述
ready Bool IptablesEIP 是否配置完成
ip String IptablesEIP 使用的 IP 地址,目前只支持了 IPv4 地址
redo String IptablesEIP crd 创建或者更新时间
nat String IptablesEIP 的使用类型,取值为 fipsnat 或者 dnat
conditions []IptablesEIPCondition IptablesEIP 状态变化信息,具体字段参考文档开头 Condition 定义

IptablesFIPRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IptablesFIPRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IptablesFIPRuleSpec Vpc 网关使用的 IptablesFIPRule 具体配置信息字段
status IptablesFIPRuleStatus Vpc 网关使用的 IptablesFIPRule 状态信息

IptablesFIPRuleSpec

属性名称 类型 描述
eip String IptablesFIPRule 使用的 IptablesEIP 名称
internalIp String IptablesFIPRule 对应的内部的 IP 地址

IptablesFIPRuleStatus

属性名称 类型 描述
ready Bool IptablesFIPRule 是否配置完成
v4ip String IptablesEIP 使用的 v4 IP 地址
v6ip String IptablesEIP 使用的 v6 IP 地址
natGwDp String Vpc 网关名称
redo String IptablesFIPRule crd 创建或者更新时间
conditions []IptablesFIPRuleCondition IptablesFIPRule 状态变化信息,具体字段参考文档开头 Condition 定义

IptablesSnatRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IptablesSnatRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IptablesSnatRuleSpec Vpc 网关使用的 IptablesSnatRule 具体配置信息字段
status IptablesSnatRuleStatus Vpc 网关使用的 IptablesSnatRule 状态信息

IptablesSnatRuleSpec

属性名称 类型 描述
eip String IptablesSnatRule 使用的 IptablesEIP 名称
internalIp String IptablesSnatRule 对应的内部的 IP 地址

IptablesSnatRuleStatus

属性名称 类型 描述
ready Bool IptablesSnatRule 是否配置完成
v4ip String IptablesSnatRule 使用的 v4 IP 地址
v6ip String IptablesSnatRule 使用的 v6 IP 地址
natGwDp String Vpc 网关名称
redo String IptablesSnatRule crd 创建或者更新时间
conditions []IptablesSnatRuleCondition IptablesSnatRule 状态变化信息,具体字段参考文档开头 Condition 定义

IptablesDnatRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 IptablesDnatRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec IptablesDnatRuleSpec Vpc 网关使用的 IptablesDnatRule 具体配置信息字段
status IptablesDnatRuleStatus Vpc 网关使用的 IptablesDnatRule 状态信息

IptablesDnatRuleSpec

属性名称 类型 描述
eip Sting Vpc 网关配置 IptablesDnatRule 使用的 IptablesEIP 名称
externalPort Sting Vpc 网关配置 IptablesDnatRule 使用的外部端口
protocol Sting Vpc 网关配置 IptablesDnatRule 的协议类型
internalIp Sting Vpc 网关配置 IptablesDnatRule 使用的内部 IP 地址
internalPort Sting Vpc 网关配置 IptablesDnatRule 使用的内部端口

IptablesDnatRuleStatus

属性名称 类型 描述
ready Bool IptablesDnatRule 是否配置完成
v4ip String IptablesDnatRule 使用的 v4 IP 地址
v6ip String IptablesDnatRule 使用的 v6 IP 地址
natGwDp String Vpc 网关名称
redo String IptablesDnatRule crd 创建或者更新时间
conditions []IptablesDnatRuleCondition IptablesDnatRule 状态变化信息,具体字段参考文档开头 Condition 定义

VpcDns

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 VpcDns
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VpcDnsSpec VpcDns 具体配置信息字段
status VpcDnsStatus VpcDns 状态信息

VpcDnsSpec

属性名称 类型 描述
vpc String VpcDns 所在的 Vpc 名称
subnet String VpcDns Pod 分配地址的 Subnet 名称

VpcDnsStatus

属性名称 类型 描述
conditions []VpcDnsCondition VpcDns 状态变化信息,具体字段参考文档开头 Condition 定义
active Bool VpcDns 是否正在使用

VpcDns 的详细使用文档,可以参考 自定义 VPC 内部 DNS

SwitchLBRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 SwitchLBRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec SwitchLBRuleSpec SwitchLBRule 具体配置信息字段
status SwitchLBRuleStatus SwitchLBRule 状态信息

SwitchLBRuleSpec

属性名称 类型 描述
vip String SwitchLBRule 配置的 vip 地址
namespace String SwitchLBRule 的命名空间
selector []String 标准 Kubernetes Selector 匹配信息
sessionAffinity String 标准 Kubernetes Service 中 sessionAffinity 取值
ports []SlrPort SwitchLBRule 端口列表

SwitchLBRule 的详细配置信息,可以参考 自定义 VPC 内部负载均衡

SlrPort
属性名称 类型 描述
name String 端口名称
port Int32 端口号
targetPort Int32 目标端口号
protocol String 协议类型

SwitchLBRuleStatus

属性名称 类型 描述
conditions []SwitchLBRuleCondition SwitchLBRule 状态变化信息,具体字段参考文档开头 Condition 定义
ports String SwitchLBRule 端口信息
service String SwitchLBRule 提供服务的 service 名称

安全组与 Vip

SecurityGroup

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 SecurityGroup
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec SecurityGroupSpec 安全组具体配置信息字段
status SecurityGroupStatus 安全组状态信息

SecurityGroupSpec

属性名称 类型 描述
ingressRules []*SgRule 入方向安全组规则
egressRules []*SgRule 出方向安全组规则
allowSameGroupTraffic Bool 同一安全组内的 lsp 是否可以互通,以及流量规则是否需要更新
SgRule
属性名称 类型 描述
ipVersion String IP 版本号,取值为 ipv4 或者 ipv6
protocol String 取值为 allicmptcp 或者 udp
priority Int Acl 优先级,取值范围为 1-200,数值越小,优先级越高
remoteType String 取值为 address 或者 securityGroup
remoteAddress String 对端地址
remoteSecurityGroup String 对端安全组
portRangeMin Int 端口范围起始值,最小取值为 1
portRangeMax Int 端口范围最大值,最大取值为 65535
policy String 取值为 allow 或者 drop

SecurityGroupStatus

属性名称 类型 描述
portGroup String 安全组对应的 port-group 名称
allowSameGroupTraffic Bool 同一安全组内的 lsp 是否可以互通,以及安全组的流量规则是否需要更新
ingressMd5 String 入方向安全组规则 MD5 取值
egressMd5 String 出方向安全组规则 MD5 取值
ingressLastSyncSuccess Bool 入方向规则上一次同步是否成功
egressLastSyncSuccess Bool 出方向规则上一次同步是否成功

Vip

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 Vip
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec VipSpec Vip 具体配置信息字段
status VipStatus Vip 状态信息

VipSpec

属性名称 类型 描述
namespace String Vip 所在命名空间
subnet String Vip 所属子网
type String Vip 使用类型,取值为 switch_lb_vip 或空
v4ip String Vip v4 IP 地址
v6ip String Vip v6 IP 地址
macAddress String Vip mac 地址
parentV4ip String 目前没有使用
parentV6ip String 目前没有使用
parentMac String 目前没有使用
selector []String 标准 Kubernetes Selector 匹配信息
attachSubnets []String 该字段废弃,不再使用

VipStatus

属性名称 类型 描述
conditions []VipCondition Vip 状态变化信息,具体字段参考文档开头 Condition 定义
ready Bool Vip 是否准备好
v4ip String Vip v4 IP 地址,应该和 spec 字段取值一致
v6ip String Vip v6 IP 地址,应该和 spec 字段取值一致
mac String Vip mac 地址,应该和 spec 字段取值一致
pv4ip String 目前没有使用
pv6ip String 目前没有使用
pmac String 目前没有使用

OvnEip

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 OvnEip
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec OvnEipSpec 默认 Vpc 使用 OvnEip 具体配置信息字段
status OvnEipStatus 默认 Vpc 使用 OvnEip 状态信息

OvnEipSpec

属性名称 类型 描述
externalSubnet String OvnEip 所在的子网名称
v4Ip String OvnEip IPv4 地址
v6Ip String OvnEip IPv6 地址
macAddress String OvnEip Mac 地址
type String OvnEip 使用类型,取值有 lrplsp 或者 nat

OvnEipStatus

属性名称 类型 描述
conditions []OvnEipCondition 默认 Vpc OvnEip 状态变化信息,具体字段参考文档开头 Condition 定义
type String OvnEip 使用类型, 可以是 lrp, lsp or nat
nat String dnat snat fip
v4Ip String OvnEip 使用的 v4 IP 地址
v6Ip String OvnEip 使用的 v6 IP 地址
macAddress String OvnEip 使用的 Mac 地址

OvnFip

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 OvnFip
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec OvnFipSpec 默认 Vpc 使用 OvnFip 具体配置信息字段
status OvnFipStatus 默认 Vpc 使用 OvnFip 状态信息

OvnFipSpec

属性名称 类型 描述
ovnEip String OvnFip 绑定的 OvnEip 名称
ipType String vip 或者 ip crd ("" 表示 ip crd)
ipName String OvnFip 绑定 Pod 对应的 IP crd 名称
vpc String Pod 所在的 VPC 的名字
V4Ip String IP 或者 VIP 的 IPv4 地址

OvnFipStatus

属性名称 类型 描述
ready Bool OvnFip 是否配置完成
v4Eip String OvnFip 绑定的 OvnEip 名称
v4Ip String OvnFip 当前使用的 OvnEip 地址
vpc String OvnFip 所在的 Vpc 名称
conditions []OvnFipCondition OvnFip 状态变化信息,具体字段参考文档开头 Condition 定义

OvnSnatRule

属性名称 类型 描述
apiVersion String 标准 Kubernetes 版本信息字段,所有自定义资源该值均为 kubeovn.io/v1
kind String 标准 Kubernetes 资源类型字段,本资源所有实例该值均为 OvnSnatRule
metadata ObjectMeta 标准 Kubernetes 资源元数据信息
spec OvnSnatRuleSpec 默认 Vpc OvnSnatRule 具体配置信息字段
status OvnSnatRuleStatus 默认 Vpc OvnSnatRule 状态信息

OvnSnatRuleSpec

属性名称 类型 描述
ovnEip String OvnSnatRule 绑定的 OvnEip 名称
vpcSubnet String OvnSnatRule 配置的子网名称
vpc String Pod 所在的 VPC
ipName String OvnSnatRule 绑定 Pod 对应的 IP crd 名称
v4IpCidr String vpc subnet 的 IPv4 cidr

OvnSnatRuleStatus

属性名称 类型 描述
ready Bool OvnSnatRule 是否配置完成
v4Eip String OvnSnatRule 绑定的 OvnEip 地址
v4IpCidr String 在 logical-router 中配置 snat 转换使用的 cidr 地址
vpc String OvnSnatRule 所在的 Vpc 名称
conditions []OvnSnatRuleCondition OvnSnatRule 状态变化信息,具体字段参考文档开头 Condition 定义

微信群 Slack Twitter Support


最后更新: 2023年12月22日
创建日期: 2023年2月16日

评论

准备工作

Kube-OVN 是一个符合 CNI 规范的网络组件,其运行需要依赖 Kubernetes 环境及对应的内核网络模块。 以下是通过测试的操作系统和软件版本,环境配置和所需要开放的端口信息。

软件版本

  • Kubernetes >= 1.23。
  • Docker >= 1.12.6, Containerd >= 1.3.4。
  • 操作系统: CentOS 7/8, Ubuntu 16.04/18.04/20.04。
  • 其他 Linux 发行版,需要检查一下内核模块是否存在 geneve, openvswitch, ip_tablesiptable_nat,Kube-OVN 正常工作依赖上述模块。

注意事项

  1. 如果内核版本为 3.10.0-862 内核 netfilter 模块存在 bug 会导致 Kube-OVN 内置负载均衡器无法工作,需要对内核升级,建议使用 CentOS 官方对应版本最新内核保证系统的安全。相关内核 bug 参考 Floating IPs broken after kernel upgrade to Centos/RHEL 7.5 - DNAT not working
  2. Rocky Linux 8.6 的内核 4.18.0-372.9.1.el8.x86_64 存在 TCP 通信问题 TCP connection failed in Rocky Linux 8.6,请升级内核至 4.18.0-372.13.1.el8_6.x86_64 或更高版本。
  3. 如果内核版本为 4.4 则对应的内核 openvswitch 模块存在问题,建议升级或手动编译 openvswitch 新版本模块进行更新
  4. Geneve 隧道建立需要检查 IPv6,可通过 cat /proc/cmdline 检查内核启动参数, 相关内核 bug 请参考 Geneve tunnels don't work when ipv6 is disabled

环境配置

  • Kernel 启动需要开启 ipv6, 如果 kernel 启动参数包含 ipv6.disable=1 需要将其设置为 0。
  • kube-proxy 正常工作,Kube-OVN 可以通过 SVC IP 访问到 kube-apiserver
  • 确认 kubelet 配置参数开启了 CNI,并且配置在标准路径下, kubelet 启动时应包含如下参数 --network-plugin=cni --cni-bin-dir=/opt/cni/bin --cni-conf-dir=/etc/cni/net.d
  • 确认未安装其他网络插件,或者其他网络插件已经被清除,检查 /etc/cni/net.d/ 路径下无其他网络插件配置文件。如果之前安装过其他网络插件,建议删除后重启机器清理残留网络资源。

端口信息

组件 端口 用途
ovn-central 6641/tcp, 6642/tcp, 6643/tcp, 6644/tcp ovn-db 和 raft server 监听端口
ovs-ovn Geneve 6081/udp, STT 7471/tcp, Vxlan 4789/udp 隧道端口
kube-ovn-controller 10660/tcp 监控监听端口
kube-ovn-daemon 10665/tcp 监控监听端口
kube-ovn-monitor 10661/tcp 监控监听端口

微信群 Slack Twitter Support


最后更新: 2023年7月20日
创建日期: 2022年5月20日

评论

准备工作

Kube-OVN 是一个符合 CNI 规范的网络组件,其运行需要依赖 Kubernetes 环境及对应的内核网络模块。 以下是通过测试的操作系统和软件版本,环境配置和所需要开放的端口信息。

软件版本

  • Kubernetes >= 1.23。
  • Docker >= 1.12.6, Containerd >= 1.3.4。
  • 操作系统: CentOS 7/8, Ubuntu 16.04/18.04/20.04。
  • 其他 Linux 发行版,需要检查一下内核模块是否存在 geneve, openvswitch, ip_tablesiptable_nat,Kube-OVN 正常工作依赖上述模块。

注意事项

  1. 如果内核版本为 3.10.0-862 内核 netfilter 模块存在 bug 会导致 Kube-OVN 内置负载均衡器无法工作,需要对内核升级,建议使用 CentOS 官方对应版本最新内核保证系统的安全。相关内核 bug 参考 Floating IPs broken after kernel upgrade to Centos/RHEL 7.5 - DNAT not working
  2. Rocky Linux 8.6 的内核 4.18.0-372.9.1.el8.x86_64 存在 TCP 通信问题 TCP connection failed in Rocky Linux 8.6,请升级内核至 4.18.0-372.13.1.el8_6.x86_64 或更高版本。
  3. 如果内核版本为 4.4 则对应的内核 openvswitch 模块存在问题,建议升级或手动编译 openvswitch 新版本模块进行更新
  4. Geneve 隧道建立需要检查 IPv6,可通过 cat /proc/cmdline 检查内核启动参数, 相关内核 bug 请参考 Geneve tunnels don't work when ipv6 is disabled

环境配置

  • Kernel 启动需要开启 IPv6, 如果 kernel 启动参数包含 ipv6.disable=1 需要将其设置为 0。
  • kube-proxy 正常工作,Kube-OVN 可以通过 Service ClusterIP 访问到 kube-apiserver
  • 确认 kubelet 配置参数开启了 CNI,并且配置在标准路径下, kubelet 启动时应包含如下参数 --network-plugin=cni --cni-bin-dir=/opt/cni/bin --cni-conf-dir=/etc/cni/net.d
  • 确认未安装其他网络插件,或者其他网络插件已经被清除,检查 /etc/cni/net.d/ 路径下无其他网络插件配置文件。如果之前安装过其他网络插件,建议删除后重启机器清理残留网络资源。

端口信息

组件 端口 用途
ovn-central 6641/tcp, 6642/tcp, 6643/tcp, 6644/tcp ovn-db 和 raft server 监听端口
ovs-ovn Geneve 6081/udp, STT 7471/tcp, Vxlan 4789/udp 隧道端口
kube-ovn-controller 10660/tcp 监控监听端口
kube-ovn-daemon 10665/tcp 监控监听端口
kube-ovn-monitor 10661/tcp 监控监听端口

微信群 Slack Twitter Support


最后更新: 2023年12月25日
创建日期: 2022年5月20日

评论