10.3.2. Create a primary user-defined network by using the CLI
You can create a primary UserDefinedNetwork or ClusterUserDefinedNetwork custom resource definition (CRD) by using the OpenShift CLI (oc). After you define the custom primary overlay network, you can create namespaces that are associated with the cluster-scoped UDN.
10.3.2.1. Creating a namespace for user-defined networks by using the CLI リンクのコピーリンクがクリップボードにコピーされました!
You can create a namespace to be used with primary user-defined networks (UDNs) by using the OpenShift CLI (oc).
Prerequisites
-
You have access to the cluster as a user with
cluster-adminpermissions. -
You have installed the OpenShift CLI (
oc).
Procedure
Create a
Namespaceobject as a YAML file similar to the following example:apiVersion: v1 kind: Namespace metadata: name: my-namespace labels: k8s.ovn.org/primary-user-defined-network: "" # ...The
k8s.ovn.org/primary-user-defined-networklabel is required for the namespace to be associated with a UDN. If the namespace is to be used with an existing cluster UDN, you must also add the appropriate labels that are defined in thespec.namespaceSelectorfield of theClusterUserDefinedNetworkcustom resource.Apply the
Namespacemanifest by running the following command:$ oc apply -f <filename>.yaml