mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
40 lines
1.5 KiB
Plaintext
40 lines
1.5 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
|
|
|
|
[role="_abstract"]
|
|
Although the `MultiNetworkPolicy` API implements the `NetworkPolicy` API, ensure that you understand the following key differences between the two policies:
|
|
|
|
* You must use the `MultiNetworkPolicy` API, as demonstrated in the following example configuration:
|
|
+
|
|
[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. The following example multi-network policy 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.
|
|
|