1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/nw-multus-create-network-apply.adoc
2026-01-13 13:25:40 +00:00

56 lines
1.5 KiB
Plaintext

// Module included in the following assemblies:
//
// * networking/multiple_networks/primary_networks/about-primary-nwt-nad.adoc
:_mod-docs-content-type: PROCEDURE
[id="nw-multus-create-network-apply_{context}"]
= Creating a primary network attachment by applying a YAML manifest
[role="_abstract"]
Create a primary network attachment by directly applying a `NetworkAttachmentDefinition` YAML manifest. This gives you full control over the network configuration without relying on the Cluster Network Operator to manage the resource automatically.
.Prerequisites
* You have installed the {oc-first}.
* You have logged in as a user with `cluster-admin` privileges.
* You are working in the namespace where the NAD is to be deployed.
.Procedure
. Create a YAML file with your primary network configuration, such as in the following example:
+
[source,yaml]
----
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
name: next-net
spec:
config: |-
{
"cniVersion": "0.3.1",
"name": "work-network",
"namespace": "namespace2",
"type": "host-device",
"device": "eth1",
"ipam": {
"type": "dhcp"
}
}
----
+
.. Optional: You can specify a namespace to which the NAD is applied. If you are working in the namespace where the NAD is to be deployed, the `namespace` specification is not necessary.
. To create the primary network, enter the following command:
+
[source,terminal]
----
$ oc apply -f <file>.yaml
----
+
--
where:
`<file>`:: Specifies the name of the file contained the YAML manifest.
--