1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/virt-creating-localnet-nad-cli.adoc
2024-02-13 16:18:05 +00:00

51 lines
1.8 KiB
Plaintext

// 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 <filename>.yaml
----