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-udn-namespace-cli.adoc
2025-11-18 16:29:25 +01:00

39 lines
1.2 KiB
Plaintext

// Module included in the following assemblies:
//
// * virt/vm_networking/virt-connecting-vm-to-primary-udn.adoc
:_mod-docs-content-type: PROCEDURE
[id="virt-creating-udn-namespace-cli_{context}"]
= Creating a namespace for user-defined networks by using the CLI
[role="_abstract"]
You can create a namespace to be used with primary user-defined networks (UDNs) by using the {oc-first}.
.Prerequisites
* You have access to the cluster as a user with `cluster-admin` permissions.
* You have installed the {oc-first}.
.Procedure
. Create a `Namespace` object as a YAML file similar to the following example:
+
[source,yaml]
----
apiVersion: v1
kind: Namespace
metadata:
name: my-namespace
labels:
k8s.ovn.org/primary-user-defined-network: "" # <1>
# ...
----
<1> This label 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 the `spec.namespaceSelector` field of the `ClusterUserDefinedNetwork` custom resource.
. Apply the `Namespace` manifest by running the following command:
+
[source, terminal]
----
$ oc apply -f <filename>.yaml
----