Key differences between AdminNetworkPolicy and NetworkPolicy custom resources
To choose the right network policy API for your cluster or namespace in Red Hat OpenShift Container Platform, you can compare AdminNetworkPolicy and NetworkPolicy CRs across scope, rule actions, precedence, and peer options.
The following reference table highlights differences in who can apply policies, how traffic is allowed or denied, and how OVN-Kubernetes evaluates each API.
| Policy elements | AdminNetworkPolicy | NetworkPolicy |
|---|---|---|
Applicable user |
Cluster administrator or equivalent |
Namespace owners |
Scope |
Cluster |
Namespace |
Drop traffic |
Supported with an explicit |
Supported via implicit |
Delegate traffic |
Supported with an |
Not applicable. |
Allow traffic |
Supported with an explicit |
The default action for all rules is to allow. |
Rule precedence within the policy |
Depends on the order in which they appear within an ANP. The higher the rule’s position the higher the precedence. |
Rules are additive. |
Policy precedence |
Among ANPs the |
There is no policy ordering between policies. |
Feature precedence |
Evaluated first via tier 1 ACL and BANP is evaluated last via tier 3 ACL. |
Enforced after ANP and before BANP, they are evaluated in tier 2 of the ACL. |
Matching pod selection |
Can apply different rules across namespaces. |
Can apply different rules across pods in single namespace. |
Cluster egress traffic |
Supported via |
Supported through |
Cluster ingress traffic |
Not supported. |
Not supported. |
Fully qualified domain names (FQDN) peer support |
Not supported. |
Not supported. |
Namespace selectors |
Supports advanced selection of Namespaces with the use of |
Supports label based namespace selection with the use of |