Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 1. Understanding network policy APIs
Network policy is defined using both cluster-scoped and namespace-scoped network policy APIs. By defining network policy across these different levels, you can create sophisticated network security configurations for your clusters, including full multi-tenant isolation.
1.1. Network policies and their scope Link kopierenLink in die Zwischenablage kopiert!
- Cluster-scoped network policy
Cluster and network administrators can use the AdminNetworkPolicy to define network policy at the cluster level. The AdminNetworkPolicy feature consists of two APIs: the
AdminNetworkPolicy
API andBaselineAdminNetworkPolicy
API. These APIs are used to set rules that can be applied to the entire cluster, or delegated to the namespace-scopedNetworkPolicy
.Policies defined using the
AdminNetworkPolicy
API take precedence over all other policy types when set to "Allow" or "Deny". However, administrators can also use "Pass" to delegate responsibility for a given policy to the namespace-scopedNetworkPolicy
to allow application developers and namespace tenants to control specific aspects of network security for their projects.Policies defined using the
BaselineAdminNetworkPolicy
API apply only when no other network policy overrides them. When you use theAdminNetworkPolicy
API to delegate an aspect of network policy to the namespace-scopedNetworkPolicy
, you should also define a sensible minimum restriction in theBaselineAdminNetworkPolicy
. This ensures a baseline level of network security at the cluster level in case theNetworkPolicy
for a namespace does not provide sufficient protection.- Namespace-scoped network policy
-
Application developers and namespace tenants can use the
NetworkPolicy
API to define network policy rules for a specific namespace. Rules in theNetworkPolicy
for a namespace take precedence over cluster-wide rules configured using the BaselineAdminNetworkPolicy API, or for a cluster-wide rule that that has been delegated or "passed" from the cluster-wideAdminNetworkPolicy
API.
1.2. How network policy is evaluated and applied Link kopierenLink in die Zwischenablage kopiert!
When a network connection is established, the network provider (default: OVN-Kubernetes) checks the connection details against network policy rules to determine how to handle the connection.
OVN-Kubernetes evaluates connections against network policy objects in the following order:
Check for matches in the AdminNetworkPolicy tier.
-
If a connection matches an
Allow
orDeny
rule, follow that rule and stop evaluating. -
If a connection matches a
Pass
rule, move to the NetworkPolicy tier.
-
If a connection matches an
Check for matches in the NetworkPolicy tier.
- If a connection matches a rule, follow that rule and stop evaluating.
- If no match is found, move to the BaselineAdminNetworkPolicy tier.
- Follow a matching rule in the BaselineAdminNetworkPolicy tier.
Figure 1.1. Evaluation of network policies by OVN-Kubernetes
1.3. Key differences between AdminNetworkPolicy and NetworkPolicy custom resources Link kopierenLink in die Zwischenablage kopiert!
The following table explains key differences between the cluster scoped AdminNetworkPolicy
API and the namespace scoped NetworkPolicy
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 |