11# Multihoming
2- A K8s pod with more than one network interface is said to be multi-homed. The
3- [ Network Plumbing Working Group] ( https://github.com/k8snetworkplumbingwg/multi-net-spec )
4- has put forward a [ standard] ( https://github.com/k8snetworkplumbingwg/multi-net-spec )
5- describing how to specify the configurations for additional network interfaces.
2+ ## Introduction
3+ Multihoming allows the configuration of secondary-network interfaces for K8s pods.
4+ OVN-Kubernetes secondary-network has three configurable topologies: layer 3, layer 2, or localnet.
65
7- There are several delegating plugins or meta-plugins (Multus, Genie)
8- implementing this standard.
6+ - A layer 3 topology is a simplification of the topology for the cluster default network - but without egress.
7+ - A layer 2 topology provides an isolated (no egress) cluster-wide layer2 network providing east-west traffic to the
8+ cluster workloads.
9+ - A localnet topology is based on layer 2 topology, but also allows connecting to an existent (configured) physical
10+ network to provide north-south traffic to the workloads.
911
10- After a pod is scheduled on a particular Kubernetes node, kubelet will invoke
11- the delegating plugin to prepare the pod for networking. This meta-plugin will
12- then invoke the CNI responsible for setting up the pod's default cluster
13- network, and afterwards it iterates the list of additional attachments on the
14- pod, invoking the corresponding delegate CNI implementing the logic to attach
15- the pod to that particular network.
12+ For layer 2 and localnet topologies, multihoming also allows IP features on secondary interfaces such as static IP
13+ allocation and persistent IP addresses for virtualization workloads.
1614
17- ## Configuring secondary networks
1815To allow pods to have multiple network interfaces, the user must provide the
1916configurations specifying how to connect to these networks; these
20- configurations are defined in a CRD named ` NetworkAttachmentDefinition ` .
17+ configurations are defined in a CRD named ` NetworkAttachmentDefinition ` , defined by
18+ the [ Kubernetes Network Custom Resource Definition De-facto Standard] ( https://github.com/k8snetworkplumbingwg/multi-net-spec ) .
19+
20+ > [ !NOTE]
21+ > layer 2 and layer 3 topologies are overlays - thus, they do not need ** any** previous physical network configuration.
22+
23+ ## Prerequisites
24+ - [ multus-cni] ( https://github.com/k8snetworkplumbingwg/multus-cni )
25+
26+ ## Motivation
27+ Multihoming is essential when you need more than one network interface on your pods. This can be useful for various
28+ use cases, such as virtual network functions (VNFs), firewalls, or virtualization (virt) where the default
29+ cluster network might not be suitable.
30+
31+ In OVN-K, multihoming supports several virt-specific features. These
32+ include [ persistent IP addresses for virtualization] ( #persistent-ip-addresses-for-virtualization-workloads ) workloads,
33+ ensuring that VMs retain their IP addresses even when they move across nodes. This enhances workload mobility and
34+ minimizes disruptions.
35+
36+ Multihoming is also compatible with the [ multi-network policy] ( multi-network-policies.md ) API, which can provide further security rules on the
37+ traffic.
38+
39+ ## User-Stories
40+ - As a Cluster-Admin, I want to configure secondary networks for specific pods so that I can enable
41+ specialized/sensitive workloads with distinct network requirements.
42+ - As a Cluster-Admin, I want to facilitate seamless live migration of VMs within so that I can maintain established TCP
43+ connections and preserve VM IP configurations during migration.
44+
45+ ## User-Cases
46+ - cluster-wide overlay network on layer 2:
47+ In this case example, two VMs from different namespaces - VMA and VMC - are connected over a secondary-network.
48+ VMB is not exposed to this traffic.
49+ ![ multi-homing-use-case-layer2] ( multi-homing-use-case-layer2.png )
50+ - cluster-wide localnet network:
51+ In this case example, Pod and VM workloads accessing a relational DB reachable via the physical network (i.e. deployed
52+ outside Kubernetes).
53+ ![ multi-homing-use-case-localnet] ( multi-homing-use-case-localnet.png )
54+
55+ ## How to enable this feature on an OVN-Kubernetes cluster?
56+ The ` multi-network ` feature must be enabled in the OVN-Kubernetes configuration.
57+ Please use the ` Feature Config ` option ` enable-multi-network ` under ` OVNKubernetesFeatureConfig ` config to enable it.
58+
59+ ## Workflow Description
60+ After a pod is scheduled on a particular Kubernetes node, kubelet will invoke
61+ the meta-plugin installed on the cluster (such as [ Multus] ( https://github.com/k8snetworkplumbingwg/multus-cni ) ) to
62+ prepare the pod for networking.
63+ The meta-plugin will invoke the CNI responsible for setting up the pod's default cluster network.
64+ After that, the meta-plugin iterates the list of secondary networks, invoking the corresponding CNI implementing
65+ the logic to attach the pod to that particular secondary-network. The CNI will use the details specified on
66+ the ` network-attachment-definition ` in order to do that.
2167
22- Below you will find example attachment configurations for each of the current
23- topologies OVN-K allows for secondary networks.
68+ > [ !NOTE]
69+ > networks are ** not** namespaced - i.e. creating multiple ` network-attachment-definition ` s with different
70+ configurations pointing at the same network (same ` NetConf.Name ` attribute) is ** not** supported.
2471
25- ** NOTE** :
26- - networks are ** not** namespaced - i.e. creating multiple
27- ` network-attachment-definition ` s with different configurations pointing at the
28- same network (same ` NetConf.Name ` attribute) is ** not** supported.
72+ ## Implementation Details
73+ ## User facing API Changes
74+ There are no user facing API Changes.
75+
76+ ## OVN-Kubernetes Implementation Details
77+ Below you will find example attachment configurations for each of the current topologies OVN-K allows for secondary
78+ networks.
2979
3080### Routed - layer 3 - topology
3181This topology is a simplification of the topology for the cluster default
4797 config : |2
4898 {
4999 "cniVersion": "1.0.0",
50- "name": "l3-network ",
100+ "name": "tenantblue ",
51101 "type": "ovn-k8s-cni-overlay",
52102 "topology":"layer3",
53103 "subnets": "10.128.0.0/16/24",
56106 }
57107` ` `
58108
59- #### Network Configuration reference
109+ #### Network Configuration reference:
110+
60111- ` name` (string, required): the name of the network. This attribute is **not** namespaced.
61112- `type` (string, required) : " ovn-k8s-cni-overlay" .
62113- `topology` (string, required) : " layer3" .
@@ -66,11 +117,13 @@ spec:
66117- `netAttachDefName` (string, required) : must match `<namespace>/<net-attach-def name>`
67118 of the surrounding object.
68119
69- ** NOTE**
70- - the `subnets` attribute indicates both the subnet across the cluster, and per node.
120+ > [! NOTE]
121+ > the `subnets` attribute indicates both the subnet across the cluster, and per node.
71122 The example above means you have a /16 subnet for the network, but each **node** has
72123 a /24 subnet.
73- - routed - layer3 - topology networks **only** allow for east/west traffic.
124+
125+ > [!NOTE]
126+ > routed - layer3 - topology networks **only** allow for east/west traffic.
74127
75128# ## Switched - layer 2 - topology
76129This topology interconnects the workloads via a cluster-wide logical switch.
88141 config: |2
89142 {
90143 "cniVersion": "1.0.0",
91- "name": "l2-network ",
144+ "name": "tenantyellow ",
92145 "type": "ovn-k8s-cni-overlay",
93146 "topology":"layer2",
94147 "subnets": "10.100.200.0/24",
@@ -111,15 +164,17 @@ spec:
111164 These IPs will be removed from the assignable IP pool, and never handed over
112165 to the pods.
113166- `allowPersistentIPs` (boolean, optional) : persist the OVN Kubernetes assigned
114- IP addresses in a `ipamclaims.k8s.cni.cncf.io` object. This IP addresses will
115- be reused by other pods if requested. Useful for KubeVirt VMs. Only makes
116- sense if the `subnets` attribute is also defined.
167+ IP addresses in a `ipamclaims.k8s.cni.cncf.io` object. This IP addresses will
168+ be reused by other pods if requested. Useful for KubeVirt VMs. Only makes
169+ sense if the `subnets` attribute is also defined.
117170
118- ** NOTE**
119- - when the subnets attribute is omitted, the logical switch implementing the
171+ > [! NOTE]
172+ > when the subnets attribute is omitted, the logical switch implementing the
120173 network will only provide layer 2 communication, and the users must configure
121174 IPs for the pods. Port security will only prevent MAC spoofing.
122- - switched - layer2 - secondary networks **only** allow for east/west traffic.
175+
176+ > [!NOTE]
177+ > switched - layer2 - secondary networks **only** allow for east/west traffic.
123178
124179# ## Switched - localnet - topology
125180This topology interconnects the workloads via a cluster-wide logical switch to
@@ -138,7 +193,7 @@ spec:
138193 config: |2
139194 {
140195 "cniVersion": "1.0.0",
141- "name": "localnet-network ",
196+ "name": "tenantblack ",
142197 "type": "ovn-k8s-cni-overlay",
143198 "topology":"localnet",
144199 "subnets": "202.10.130.112/28",
@@ -166,71 +221,21 @@ localnet network.
166221 to the pods.
167222- `vlanID` (integer, optional) : assign VLAN tag. Defaults to none.
168223- `allowPersistentIPs` (boolean, optional) : persist the OVN Kubernetes assigned
169- IP addresses in a `ipamclaims.k8s.cni.cncf.io` object. This IP addresses will
170- be reused by other pods if requested. Useful for KubeVirt VMs. Only makes
171- sense if the `subnets` attribute is also defined.
172- - `physicalNetworkName` (string, optional) : the name of the physical network to
173- which the OVN overlay will connect. When omitted, it will default to the value
174- of the localnet network `name`.
175-
176- **NOTE**
177- - when the subnets attribute is omitted, the logical switch implementing the
224+ IP addresses in a `ipamclaims.k8s.cni.cncf.io` object. This IP addresses will
225+ be reused by other pods if requested. Useful for KubeVirt VMs. Only makes
226+ sense if the `subnets` attribute is also defined.
227+
228+ > [!NOTE]
229+ > when the subnets attribute is omitted, the logical switch implementing the
178230 network will only provide layer 2 communication, and the users must configure
179231 IPs for the pods. Port security will only prevent MAC spoofing.
180232
181- # ### Sharing the same physical network mapping
182- To prevent the admin from having to reconfigure the cluster nodes whenever they
183- want to - let's say - add a VLAN, OVN-Kubernetes allows multiple network
184- overlays to re-use the same physical network mapping.
185-
186- To do this, the cluster admin would provision two different networks (with
187- different VLAN tags) using the **same** physical network name. Please check the
188- example below for an example of this configuration :
189- ` ` ` yaml
190- ---
191- apiVersion: k8s.cni.cncf.io/v1
192- kind: NetworkAttachmentDefinition
193- metadata:
194- name: bluenet
195- namespace: test
196- spec:
197- config: |
198- {
199- "cniVersion": "0.3.1",
200- "name": "tenantblue",
201- "type": "ovn-k8s-cni-overlay",
202- "topology": "localnet",
203- "netAttachDefName": "test/bluenet",
204- "vlanID": 4000,
205- "physicalNetworkName": "physnet"
206- }
207- ---
208- apiVersion: k8s.cni.cncf.io/v1
209- kind: NetworkAttachmentDefinition
210- metadata:
211- name: isolatednet
212- namespace: test
213- spec:
214- config: |
215- {
216- "cniVersion": "0.3.1",
217- "name": "sales",
218- "type": "ovn-k8s-cni-overlay",
219- "topology": "localnet",
220- "netAttachDefName": "test/isolatednet",
221- "vlanID": 1234,
222- "physicalNetworkName": "physnet"
223- }
224- ` ` `
225-
226- > [!WARNING]
227- > Keep in mind OVN-Kubernetes does **not** validate the physical network
228- > configurations in any way: the admin must ensure these configurations are
229- > holistically healthy - e.g. the defined subnets do not overlap, the MTUs make
230- > sense, etc.
233+ > [!NOTE]
234+ > updates to the network specification require the attached workloads restart. All the network-attachment-definitions
235+ pointing to the same network must have a consistent configuration, and then workloads must be restarted.
231236
232- # # Pod configuration
233- The user must specify the secondary network attachments via the
237+ # ## Setting a secondary-network on the pod
238+ The user must specify the secondary- network attachments via the
234239` k8s.v1.cni.cncf.io/networks` annotation.
235240
236241The following example provisions a pod with two secondary attachments, one for
@@ -256,8 +261,8 @@ spec:
256261
257262# ## Setting static IP addresses on a pod
258263The user can specify attachment parameters via
259- [network-selection-elements](https://github.com/k8snetworkplumbingwg/network-attachment-definition-client/blob/63033d5c63d1cf56f924a5454c8f2ac444b6736d/pkg/apis/k8s.cni.cncf.io/v1/types.go#L137)
260- , namely IP, MAC, and interface name.
264+ [network-selection-elements](https://github.com/k8snetworkplumbingwg/network-attachment-definition-client/blob/63033d5c63d1cf56f924a5454c8f2ac444b6736d/pkg/apis/k8s.cni.cncf.io/v1/types.go#L137),
265+ namely IP, MAC, and interface name.
261266
262267Refer to the following yaml for an example on how to request a static IP for a
263268pod, a MAC address, and specify the pod interface name.
@@ -288,13 +293,15 @@ spec:
288293 name: agnhost-container
289294` ` `
290295
291- ** NOTE:**
292- - the user can specify the IP address for a pod's secondary attachment
296+ > [! NOTE]
297+ > the user can specify the IP address for a pod's secondary attachment
293298 **only** for an L2 or localnet attachment.
294- - specifying a static IP address for the pod is only possible when the
299+
300+ > [!NOTE]
301+ > specifying a static IP address for the pod is only possible when the
295302 attachment configuration does **not** feature subnets.
296303
297- # # Persistent IP addresses for virtualization workloads
304+ # ## Persistent IP addresses for virtualization workloads
298305OVN-Kubernetes provides persistent IP addresses for virtualization workloads,
299306allowing VMs to have the same IP addresses when they migrate, when they restart,
300307and when they stop, the resume operation.
@@ -305,10 +312,11 @@ other network knobs, all NADs pointing to the same network **must** feature the
305312same configuration - i.e. all NADs in the network must either allow (or reject)
306313persistent IPs.
307314
308- The client application (which creates the VM, and manages its lifecycle) is
315+ The client application (which creates the
316+ VM, and manages its lifecycle) is
309317responsible for creating the `ipamclaims.k8s.cni.cncf.io` object, and point to
310- it in the network selection element upon pod creation; OVN-Kubernetes will then
311- persist the IP addresses it has allocated the pod in the `IPAMClaim`. This flow
318+ it in the network selection element upon pod creation;
319+ OVN-Kubernetes will then persist the IP addresses it has allocated the pod in the `IPAMClaim`. This flow
312320is portrayed in the sequence diagram below.
313321
314322` ` ` mermaid
@@ -375,16 +383,19 @@ For both ipv4 and ipv6 the following parameters are configured using DHCP or RAs
375383- mtu (taken from network attachment definition)
376384
377385# ## Configuring dns server
378- By default the DHCP server at ovn-kuberntes will configure the kubernetes
386+ By default, the DHCP server at ovn-kubernetes will configure the kubernetes
379387default dns service `kube-system/kube-dns` as the name server. This can be
380388overridden with the following command line options :
381389- dns-service-namespace
382390- dns-service-name
383391
384392# # Limitations
385- OVN-K currently does **not** support :
393+ OVN-Kubernetes currently does **not** support :
394+
386395- the same attachment configured multiple times in the same pod - i.e.
387396 `k8s.v1.cni.cncf.io/networks : l3-network,l3-network` is invalid.
388397- updates to the network selection elements lists - i.e. `k8s.v1.cni.cncf.io/networks` annotation
398+ - external IPAM - i.e. the user can't define the IPAM attribute in the configuration. They must use the subnets
399+ attribute.
389400- IPv6 link local addresses not derived from the MAC address as described in RFC 2373, like Privacy Extensions defined by RFC 4941,
390401 or the Opaque Identifier generation methods defined in RFC 7217.
0 commit comments