From 8a04ffee9c8b32bbad14f271184306700b3d6032 Mon Sep 17 00:00:00 2001 From: Ricardo Katz Date: Mon, 26 Jul 2021 13:54:34 -0300 Subject: [PATCH] Network Policy - EndPort to Beta (#28860) * Move endPort field to beta and v1.22 * Add note about CNI not supporting endport --- .../services-networking/network-policies.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/content/en/docs/concepts/services-networking/network-policies.md b/content/en/docs/concepts/services-networking/network-policies.md index 2c9ed4a90e..face681d87 100644 --- a/content/en/docs/concepts/services-networking/network-policies.md +++ b/content/en/docs/concepts/services-networking/network-policies.md @@ -223,7 +223,7 @@ You must be using a {{< glossary_tooltip text="CNI" term_id="cni" >}} plugin tha ## Targeting a range of Ports -{{< feature-state for_k8s_version="v1.21" state="alpha" >}} +{{< feature-state for_k8s_version="v1.22" state="beta" >}} When writing a NetworkPolicy, you can target a range of ports instead of a single port. @@ -251,10 +251,15 @@ spec: endPort: 32768 ``` -The above rule allows any Pod with label `db` on the namespace `default` to communicate with any IP within the range `10.0.0.0/24` over TCP, provided that the target port is between the range 32000 and 32768. +The above rule allows any Pod with label `db` on the namespace `default` to communicate +with any IP within the range `10.0.0.0/24` over TCP, provided that the target +port is between the range 32000 and 32768. The following restrictions apply when using this field: -* As an alpha feature, this is disabled by default. To enable the `endPort` field at a cluster level, you (or your cluster administrator) need to enable the `NetworkPolicyEndPort` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) for the API server with `--feature-gates=NetworkPolicyEndPort=true,…`. +* As a beta feature, this is enabled by default. To disable the `endPort` field +at a cluster level, you (or your cluster administrator) need to disable the +`NetworkPolicyEndPort` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) +for the API server with `--feature-gates=NetworkPolicyEndPort=false,…`. * The `endPort` field must be equal than or greater to the `port` field. * `endPort` can only be defined if `port` is also defined. * Both ports must be numeric. @@ -262,6 +267,9 @@ The following restrictions apply when using this field: {{< note >}} Your cluster must be using a {{< glossary_tooltip text="CNI" term_id="cni" >}} plugin that supports the `endPort` field in NetworkPolicy specifications. +If your [network plugin](/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/) +does not support the `endPort` field and you specify a NetworkPolicy with that, +the policy will be applied only for the single `port` field. {{< /note >}} ## Targeting a Namespace by its name