Skip to content

Commit 0439dac

Browse files
author
Shikha Jhala
committed
CNV-18089: OVN-Kubernetes secondary networks
1 parent 2bd9c01 commit 0439dac

File tree

4 files changed

+154
-0
lines changed

4 files changed

+154
-0
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3791,6 +3791,8 @@ Topics:
37913791
File: virt-connecting-vm-to-sriov
37923792
- Name: Using DPDK with SR-IOV
37933793
File: virt-using-dpdk-with-sriov
3794+
- Name: Connecting a VM to an OVN-Kubernetes secondary network
3795+
File: virt-connecting-vm-to-ovn-secondary-network
37943796
- Name: Hot plugging secondary network interfaces
37953797
File: virt-hot-plugging-network-interfaces
37963798
- Name: Connecting a VM to a service mesh
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="virt-attaching-vm-to-ovn-secondary-nw-cli_{context}"]
7+
= Attaching a virtual machine to an OVN-Kubernetes secondary network using the CLI
8+
9+
You can connect a virtual machine (VM) to the OVN-Kubernetes secondary network by including the network details in the VM configuration.
10+
11+
.Prerequisites
12+
* You have access to the cluster as a user with `cluster-admin` privileges.
13+
* You have installed the OpenShift CLI (`oc`).
14+
15+
.Procedure
16+
. Edit the `VirtualMachine` manifest to add the OVN-Kubernetes secondary network interface details, as in the following example:
17+
+
18+
[source,yaml]
19+
----
20+
apiVersion: kubevirt.io/v1
21+
kind: VirtualMachine
22+
metadata:
23+
name: vm-server
24+
spec:
25+
running: true
26+
template:
27+
spec:
28+
domain:
29+
devices:
30+
interfaces:
31+
- name: default
32+
masquerade: {}
33+
- name: secondary <1>
34+
bridge: {}
35+
resources:
36+
requests:
37+
memory: 1024Mi
38+
networks:
39+
- name: default
40+
pod: {}
41+
- name: secondary <2>
42+
multus:
43+
networkName: l2-network <3>
44+
# ...
45+
----
46+
<1> The name of the OVN-Kubernetes secondary interface.
47+
<2> The name of the network. This must match the value of the `spec.template.spec.domain.devices.interfaces.name` field.
48+
<3> The name of the `NetworkAttachmentDefinition` object.
49+
50+
. Apply the `VirtualMachine` manifest:
51+
+
52+
[source,terminal]
53+
----
54+
$ oc apply -f <filename>.yaml
55+
----
56+
57+
. Optional: If you edited a running virtual machine, you must restart it for the changes to take effect.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="virt-creating-layer2-nad-cli_{context}"]
7+
= Creating a NAD for flat layer 2 topology using the CLI
8+
9+
You can create a network attachment definition (NAD) which describes how to attach a pod to the layer 2 overlay network.
10+
11+
.Prerequisites
12+
* You have access to the cluster as a user with `cluster-admin` privileges.
13+
* You have installed the OpenShift CLI (`oc`).
14+
15+
.Procedure
16+
17+
. Create a `NetworkAttachmentDefinition` object:
18+
+
19+
[source,yaml]
20+
----
21+
apiVersion: k8s.cni.cncf.io/v1
22+
kind: NetworkAttachmentDefinition
23+
metadata:
24+
name: l2-network
25+
namespace: my-namespace
26+
spec:
27+
config: |2
28+
{
29+
"cniVersion": "0.3.1", <1>
30+
"name": "my-namespace-l2-network", <2>
31+
"type": "ovn-k8s-cni-overlay", <3>
32+
"topology":"layer2", <4>
33+
"mtu": 1300, <5>
34+
"netAttachDefName": "my-namespace/l2-network" <6>
35+
}
36+
----
37+
<1> The CNI specification version. The required value is `0.3.1`.
38+
<2> The name of the network. This attribute is not namespaced. For example, you can have a network named `l2-network` referenced from two different `NetworkAttachmentDefinition` objects that exist in two different namespaces. This feature is useful to connect VMs in different namespaces.
39+
<3> The name of the CNI plug-in to be configured. The required value is `ovn-k8s-cni-overlay`.
40+
<4> The topological configuration for the network. The required value is `layer2`.
41+
<5> Optional: The maximum transmission unit (MTU) value. The default value is automatically set by the kernel.
42+
<6> The value of the `namespace` and `name` fields in the `metadata` stanza of the `NetworkAttachmentDefinition` object.
43+
+
44+
[NOTE]
45+
====
46+
The above example configures a cluster-wide overlay without a subnet defined. This means that the logical switch implementing the network only provides layer 2 communication. You must configure an IP address when you create the virtual machine by either setting a static IP address or by deploying a DHCP server on the network for a dynamic IP address.
47+
====
48+
49+
. Apply the manifest:
50+
+
51+
[source,terminal]
52+
----
53+
$ oc apply -f <filename>.yaml
54+
----
55+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
:_content-type: ASSEMBLY
2+
[id="virt-connecting-vm-to-ovn-secondary-network"]
3+
= Connecting a virtual machine to an OVN-Kubernetes secondary network
4+
include::_attributes/common-attributes.adoc[]
5+
:context: virt-connecting-vm-to-ovn-secondary-network
6+
7+
toc::[]
8+
9+
You can connect a virtual machine (VM) to an OVN-Kubernetes secondary network. The OVN-Kubernetes Container Network Interface (CNI) plug-in uses the Geneve (Generic Network Virtualization Encapsulation) protocol to create an overlay network between nodes.
10+
11+
{VirtProductName} currently supports the flat layer 2 topology. This topology connects workloads by a cluster-wide logical switch. You can use this overlay network to connect VMs on different nodes, without having to configure any additional physical networking infrastructure.
12+
13+
To configure an OVN-Kubernetes secondary network and attach a VM to that network, perform the following steps:
14+
15+
. Create a network attachment definition (NAD) by using the web console or the xref:../../virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc#virt-creating-layer2-nad-cli_virt-connecting-vm-to-ovn-secondary-network[CLI].
16+
17+
. Add information about the secondary network interface to the VM specification by using the web console or the xref:../../virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc#virt-attaching-vm-to-ovn-secondary-nw-cli_virt-connecting-vm-to-ovn-secondary-network[CLI].
18+
19+
20+
[id="creating-ovn-layer2-nad"]
21+
== Creating an OVN-Kubernetes NAD
22+
23+
You can create an OVN-Kubernetes flat layer 2 network attachment definition (NAD) by using the {product-title} web console or the CLI.
24+
25+
26+
include::modules/virt-creating-layer2-nad-cli.adoc[leveloffset=+2]
27+
28+
29+
[id="attaching-vm-to-ovn-secondary-nw"]
30+
== Attaching a virtual machine to the OVN-Kubernetes secondary network
31+
32+
You can attach a virtual machine (VM) to the OVN-Kubernetes secondary network interface by using the {product-title} web console or the CLI.
33+
34+
include::modules/virt-attaching-vm-to-ovn-secondary-nw-cli.adoc[leveloffset=+2]
35+
36+
37+
[role="_additional-resources"]
38+
[id="additional-resources_virt-connecting-vm-to-ovn-secondary-network"]
39+
== Additional resources
40+
* xref:../../networking/multiple_networks/configuring-additional-network.adoc#configuration-ovnk-additional-networks_configuring-additional-network[Configuration for an OVN-Kubernetes additional network]

0 commit comments

Comments
 (0)