Skip to content

Commit 1c8a25c

Browse files
committed
OSDOCS-3908: enhances egressfirewall to include nodeSelector
1 parent fd768f1 commit 1c8a25c

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

modules/nw-egressnetworkpolicy-about.adoc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ endif::ovn[]
4646

4747
[IMPORTANT]
4848
====
49-
If your egress firewall includes a deny rule for `0.0.0.0/0`, access to your {product-title} API servers is blocked. You must include the IP address range that the API servers listen on in your egress firewall rules.
50-
51-
ifdef::ovn[]
52-
If you use the OVN-Kubernetes network plugin, you must include the built-in join network `100.64.0.0/16` to allow access when using node ports together with an egress firewall. If you changed this join network during cluster installation, use the value that you specified instead of `100.64.0.0/16`.
53-
endif::ovn[]
49+
If your egress firewall includes a deny rule for `0.0.0.0/0`, access to your {product-title} API servers is blocked. You must either add allow rules for each IP address or use the `nodeSelector` type allow rule in your egress policy rules to connect to API servers.
5450
5551
The following example illustrates the order of the egress firewall rules necessary to ensure API server access:
5652

modules/nw-egressnetworkpolicy-object.adoc

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ endif::ovn[]
4949
[id="egressnetworkpolicy-rules_{context}"]
5050
== {kind} rules
5151

52-
The following YAML describes an egress firewall rule object. The `egress` stanza expects an array of one or more objects.
52+
The following YAML describes an egress firewall rule object. The user can select either an IP address range in CIDR format, a domain name, or use the `nodeSelector` to allow or deny egress traffic. The `egress` stanza expects an array of one or more objects.
5353

5454
// - OVN-Kubernetes does not support DNS
5555
// - OpenShift SDN does not support port and protocol specification
@@ -77,14 +77,16 @@ egress:
7777
to: <2>
7878
cidrSelector: <cidr> <3>
7979
dnsName: <dns_name> <4>
80-
ports: <5>
80+
nodeSelector: <label_name>: <label_value> <5>
81+
ports: <6>
8182
...
8283
----
8384
<1> The type of rule. The value must be either `Allow` or `Deny`.
8485
<2> A stanza describing an egress traffic match rule that specifies the `cidrSelector` field or the `dnsName` field. You cannot use both fields in the same rule.
8586
<3> An IP address range in CIDR format.
8687
<4> A DNS domain name.
87-
<5> Optional: A stanza describing a collection of network ports and protocols for the rule.
88+
<5> Labels are key/value pairs that the user defines. Labels are attached to objects, such as pods. The `nodeSelector` allows for one or more node labels to be selected and attached to pods.
89+
<6> Optional: A stanza describing a collection of network ports and protocols for the rule.
8890

8991
.Ports stanza
9092
[source,yaml]
@@ -143,6 +145,31 @@ spec:
143145
protocol: TCP
144146
- port: 443
145147
----
148+
149+
[id="configuringNodeSelector-example_{context}"]
150+
== Example nodeSelector for {kind}
151+
152+
As a cluster administrator, you can allow or deny egress traffic to nodes in your cluster by specifying a label using `nodeSelector`. Labels can be applied to one or more nodes. The following is an example with the `region=east` label:
153+
154+
[source,yaml]
155+
----
156+
apiVersion: v1
157+
kind: Pod
158+
metadata:
159+
name: default
160+
spec:
161+
egress:
162+
- to:
163+
nodeSelector:
164+
matchLabels:
165+
region: east
166+
type: Allow
167+
----
168+
169+
[TIP]
170+
====
171+
Instead of adding manual rules per node IP address, use node selectors to create a label that allows pods behind an egress firewall to access host network pods.
172+
====
146173
endif::ovn[]
147174

148175
ifdef::kind[]

0 commit comments

Comments
 (0)