1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-07 00:48:01 +01:00
Files
openshift-docs/modules/nw-multi-network-policy-differences.adoc

39 lines
1.4 KiB
Plaintext

// Module included in the following assemblies:
//
// * networking/multiple_networks/configuring-multi-network-policy.adoc
:_mod-docs-content-type: CONCEPT
[id="nw-multi-network-policy-differences_{context}"]
= Differences between multi-network policy and network policy
Although the `MultiNetworkPolicy` API implements the `NetworkPolicy` API, there are several important differences:
* You must use the `MultiNetworkPolicy` API:
+
[source,yaml]
----
apiVersion: k8s.cni.cncf.io/v1beta1
kind: MultiNetworkPolicy
----
* You must use the `multi-networkpolicy` resource name when using the CLI to interact with multi-network policies. For example, you can view a multi-network policy object with the `oc get multi-networkpolicy <name>` command where `<name>` is the name of a multi-network policy.
* You can use the `k8s.v1.cni.cncf.io/policy-for` annotation on a `MultiNetworkPolicy` object to point to a `NetworkAttachmentDefinition` (NAD) custom resource (CR). The NAD CR defines the network to which the policy applies.
+
.Example multi-network policy that includes the `k8s.v1.cni.cncf.io/policy-for` annotation
[source,yaml]
----
apiVersion: k8s.cni.cncf.io/v1beta1
kind: MultiNetworkPolicy
metadata:
annotations:
k8s.v1.cni.cncf.io/policy-for:<namespace_name>/<network_name>
----
+
--
where:
`<namespace_name>`:: Specifies the namespace name.
`<network_name>`:: Specifies the name of a network attachment definition.
--