Creating a primary network attachment with the Cluster Network Operator
When you specify a primary network to create by using the Cluster Network Operator (CNO), the (CNO) creates the NetworkAttachmentDefinition custom resource definition (CRD) automatically and manages it.
|
|
Do not edit the |
-
Install the OpenShift CLI (
oc). -
Log in as a user with
cluster-adminprivileges.
-
Optional: Create the namespace for the primary networks:
$ oc create namespace <namespace_name> -
To edit the CNO configuration, enter the following command:
$ 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.
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.
-
Confirm that the CNO created the
NetworkAttachmentDefinitionCRD 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.$ oc get network-attachment-definitions -n <namespace>where:
<namespace>-
Specifies the namespace for the network attachment that you added to the CNO configuration.