From 2d38f7421f2c02b20f2399331c33499258488eb6 Mon Sep 17 00:00:00 2001 From: Shikha Jhala Date: Wed, 24 Jan 2024 07:51:42 -0500 Subject: [PATCH] CNV-13682: Added procedure for OVN-K localnet topology --- ...-attaching-vm-to-ovn-secondary-nw-cli.adoc | 2 +- modules/virt-creating-layer2-nad-cli.adoc | 2 +- modules/virt-creating-localnet-nad-cli.adoc | 50 +++++++++++++++++++ ...onnecting-vm-to-ovn-secondary-network.adoc | 24 ++++++--- .../virt-networking-overview.adoc | 17 ++++++- 5 files changed, 84 insertions(+), 11 deletions(-) create mode 100644 modules/virt-creating-localnet-nad-cli.adoc diff --git a/modules/virt-attaching-vm-to-ovn-secondary-nw-cli.adoc b/modules/virt-attaching-vm-to-ovn-secondary-nw-cli.adoc index 5f822e4023..05d10b2f89 100644 --- a/modules/virt-attaching-vm-to-ovn-secondary-nw-cli.adoc +++ b/modules/virt-attaching-vm-to-ovn-secondary-nw-cli.adoc @@ -40,7 +40,7 @@ spec: pod: {} - name: secondary <2> multus: - networkName: l2-network <3> + networkName: <3> # ... ---- <1> The name of the OVN-Kubernetes secondary interface. diff --git a/modules/virt-creating-layer2-nad-cli.adoc b/modules/virt-creating-layer2-nad-cli.adoc index c6bacbe1d7..114325544c 100644 --- a/modules/virt-creating-layer2-nad-cli.adoc +++ b/modules/virt-creating-layer2-nad-cli.adoc @@ -4,7 +4,7 @@ :_mod-docs-content-type: PROCEDURE [id="virt-creating-layer2-nad-cli_{context}"] -= Creating a NAD for flat layer 2 topology using the CLI += Creating a NAD for layer 2 topology using the CLI You can create a network attachment definition (NAD) which describes how to attach a pod to the layer 2 overlay network. diff --git a/modules/virt-creating-localnet-nad-cli.adoc b/modules/virt-creating-localnet-nad-cli.adoc new file mode 100644 index 0000000000..4129ddfe23 --- /dev/null +++ b/modules/virt-creating-localnet-nad-cli.adoc @@ -0,0 +1,50 @@ +// Module included in the following assemblies: +// +// * virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc + +:_mod-docs-content-type: PROCEDURE +[id="virt-creating-localnet-nad-cli_{context}"] += Creating a NAD for localnet topology using the CLI + +You can create a network attachment definition (NAD) which describes how to attach a pod to the underlying physical network. + +.Prerequisites +* You have access to the cluster as a user with `cluster-admin` privileges. +* You have installed the OpenShift CLI (`oc`). +* You have installed the Kubernetes NMState Operator. +* You have created a `NodeNetworkConfigurationPolicy` object to map the OVN-Kubernetes secondary network to an Open vSwitch (OVS) bridge. + +.Procedure + +. Create a `NetworkAttachmentDefinition` object: ++ +[source,yaml] +---- +apiVersion: k8s.cni.cncf.io/v1 +kind: NetworkAttachmentDefinition +metadata: + name: localnet-network + namespace: default +spec: + config: |2 + { + "cniVersion": "0.3.1", <1> + "name": "localnet-network", <2> + "type": "ovn-k8s-cni-overlay", <3> + "topology": "localnet", <4> + "netAttachDefName": "default/localnet-network" <5> + } +---- +<1> The CNI specification version. The required value is `0.3.1`. +<2> The name of the network. This attribute must match the value of the `spec.desiredState.ovn.bridge-mappings.localnet` field of the `NodeNetworkConfigurationPolicy` object that defines the OVS bridge mapping. +<3> The name of the CNI plug-in to be configured. The required value is `ovn-k8s-cni-overlay`. +<4> The topological configuration for the network. The required value is `localnet`. +<5> The value of the `namespace` and `name` fields in the `metadata` stanza of the `NetworkAttachmentDefinition` object. + +. Apply the manifest: ++ +[source,terminal] +---- +$ oc apply -f .yaml +---- + diff --git a/virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc b/virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc index d39ef77343..8d5a82a8b0 100644 --- a/virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc +++ b/virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc @@ -6,20 +6,27 @@ include::_attributes/common-attributes.adoc[] toc::[] -You can connect a virtual machine (VM) to an Open Virtual Network (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. +You can connect a virtual machine (VM) to an Open Virtual Network (OVN)-Kubernetes secondary network. {VirtProductName} supports the layer 2 and localnet topologies for OVN-Kubernetes. -{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. +* A layer 2 topology connects workloads by a cluster-wide logical switch. The OVN-Kubernetes Container Network Interface (CNI) plug-in uses the Geneve (Generic Network Virtualization Encapsulation) protocol to create an overlay network between nodes. You can use this overlay network to connect VMs on different nodes, without having to configure any additional physical networking infrastructure. + +* A localnet topology connects the secondary network to the physical underlay. This enables both east-west cluster traffic and access to services running outside the cluster, but it requires additional configuration of the underlying Open vSwitch (OVS) system on cluster nodes. To configure an OVN-Kubernetes secondary network and attach a VM to that network, perform the following steps: -. 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]. +. xref:../../virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc#creating-ovn-nad[Configure an OVN-Kubernetes secondary network] by creating a network attachment definition (NAD). ++ +[NOTE] +==== +For localnet topology, you must xref:../../networking/multiple_networks/configuring-additional-network.adoc#configuring-additional-network_ovn-kubernetes-configuration-for-a-localnet-topology[configure an OVS bridge] by creating a `NodeNetworkConfigurationPolicy` object before creating the NAD. +==== -. 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]. +. xref:../../virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc#attaching-vm-to-ovn-secondary-nw[Connect the VM to the OVN-Kubernetes secondary network] by adding the network details to the VM specification. -[id="creating-ovn-layer2-nad"] +[id="creating-ovn-nad"] == Creating an OVN-Kubernetes NAD -You can create an OVN-Kubernetes flat layer 2 network attachment definition (NAD) by using the {product-title} web console or the CLI. +You can create an OVN-Kubernetes layer 2 or localnet network attachment definition (NAD) by using the {product-title} web console or the CLI. [NOTE] ==== @@ -28,6 +35,8 @@ Configuring IP address management (IPAM) in a network attachment definition for include::modules/virt-creating-layer2-nad-cli.adoc[leveloffset=+2] +include::modules/virt-creating-localnet-nad-cli.adoc[leveloffset=+2] + [id="attaching-vm-to-ovn-secondary-nw"] == Attaching a virtual machine to the OVN-Kubernetes secondary network @@ -38,4 +47,5 @@ include::modules/virt-attaching-vm-to-ovn-secondary-nw-cli.adoc[leveloffset=+2] [role="_additional-resources"] [id="additional-resources_virt-connecting-vm-to-ovn-secondary-network"] == Additional resources -* xref:../../networking/multiple_networks/configuring-additional-network.adoc#configuration-ovnk-additional-networks_configuring-additional-network[Configuration for an OVN-Kubernetes additional network] \ No newline at end of file +* xref:../../networking/multiple_networks/configuring-additional-network.adoc#configuration-ovnk-additional-networks_configuring-additional-network[Configuration for an OVN-Kubernetes additional network] +* xref:../../networking/k8s_nmstate/k8s-nmstate-about-the-k8s-nmstate-operator.adoc#k8s-nmstate-about-the-k8s-nmstate-operator[About the Kubernetes NMState Operator] \ No newline at end of file diff --git a/virt/vm_networking/virt-networking-overview.adoc b/virt/vm_networking/virt-networking-overview.adoc index bca6885a64..d665596b36 100644 --- a/virt/vm_networking/virt-networking-overview.adoc +++ b/virt/vm_networking/virt-networking-overview.adoc @@ -50,9 +50,22 @@ You can connect a VM to an SR-IOV network by performing the following steps: xref:../../virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc#virt-connecting-vm-to-ovn-secondary-network[Connecting a virtual machine to an OVN-Kubernetes secondary network]:: -You can connect a VM to an Open Virtual Network (OVN)-Kubernetes secondary network. To configure an OVN-Kubernetes secondary network and attach a VM to that network, perform the following steps: +You can connect a VM to an Open Virtual Network (OVN)-Kubernetes secondary network. {VirtProductName} supports the layer 2 and localnet topologies for OVN-Kubernetes. ++ +-- +* A layer 2 topology connects workloads by a cluster-wide logical switch. The OVN-Kubernetes Container Network Interface (CNI) plug-in uses the Geneve (Generic Network Virtualization Encapsulation) protocol to create an overlay network between nodes. You can use this overlay network to connect VMs on different nodes, without having to configure any additional physical networking infrastructure. -. xref:../../virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc#creating-ovn-layer2-nad[Configure an OVN-Kubernetes secondary network] by creating a `NetworkAttachmentDefinition` CRD. +* A localnet topology connects the secondary network to the physical underlay. This enables both east-west cluster traffic and access to services running outside the cluster, but it requires additional configuration of the underlying Open vSwitch (OVS) system on cluster nodes. +-- ++ +To configure an OVN-Kubernetes secondary network and attach a VM to that network, perform the following steps: + +. xref:../../virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc#creating-ovn-nad[Configure an OVN-Kubernetes secondary network] by creating a network attachment definition (NAD). ++ +[NOTE] +==== +For localnet topology, you must xref:../../networking/multiple_networks/configuring-additional-network.adoc#configuring-additional-network_ovn-kubernetes-configuration-for-a-localnet-topology[configure an OVS bridge] by creating a `NodeNetworkConfigurationPolicy` object before creating the NAD. +==== . xref:../../virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc#attaching-vm-to-ovn-secondary-nw[Connect the VM to the OVN-Kubernetes secondary network] by adding the network details to the VM specification.