mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
85 lines
2.3 KiB
Plaintext
85 lines
2.3 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_{context}"]
|
|
= Creating a primary network attachment with the Cluster Network Operator
|
|
|
|
The Cluster Network Operator (CNO) manages additional network definitions. When you specify a primary network to create, the CNO creates the `NetworkAttachmentDefinition` custom resource definition (CRD) automatically.
|
|
|
|
[IMPORTANT]
|
|
====
|
|
Do not edit the `NetworkAttachmentDefinition` CRDs that the Cluster Network Operator manages. Doing so might disrupt network traffic on your primary network.
|
|
====
|
|
|
|
.Prerequisites
|
|
|
|
* Install the OpenShift CLI (`oc`).
|
|
* Log in as a user with `cluster-admin` privileges.
|
|
|
|
.Procedure
|
|
|
|
. Optional: Create the namespace for the primary networks:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc create namespace <namespace_name>
|
|
----
|
|
|
|
. To edit the CNO configuration, enter the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc edit networks.operator.openshift.io cluster
|
|
----
|
|
|
|
. Modify the CR that you are creating by adding the configuration for the primary network that you are creating, as in the following example CR.
|
|
+
|
|
[source,yaml,subs="attributes+"]
|
|
----
|
|
apiVersion: operator.openshift.io/v1
|
|
kind: Network
|
|
metadata:
|
|
name: cluster
|
|
spec:
|
|
# ...
|
|
additionalNetworks:
|
|
- name: tertiary-net
|
|
namespace: namespace2
|
|
type: Raw
|
|
rawCNIConfig: |-
|
|
{
|
|
"cniVersion": "0.3.1",
|
|
"name": "tertiary-net",
|
|
"type": "ipvlan",
|
|
"master": "eth1",
|
|
"mode": "l2",
|
|
"ipam": {
|
|
"type": "static",
|
|
"addresses": [
|
|
{
|
|
"address": "192.168.1.23/24"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
----
|
|
|
|
. Save your changes and quit the text editor to commit your changes.
|
|
|
|
.Verification
|
|
|
|
* Confirm that the CNO created the `NetworkAttachmentDefinition` CRD by running the following command. A delay might exist before the CNO creates the CRD. The expected output shows the name of the NAD CRD and the creation age in minutes.
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get network-attachment-definitions -n <namespace>
|
|
----
|
|
+
|
|
--
|
|
where:
|
|
|
|
`<namespace>`:: Specifies the namespace for the network attachment that you added to the CNO configuration.
|
|
--
|