Skip to content

Commit 060814d

Browse files
authored
Merge pull request #98803 from dfitzmau/OCPBUGS-59964
OCPBUGS-59964: Documented configuring dual-stack networking for an Eg…
2 parents 7fea945 + 41c1af7 commit 060814d

10 files changed

+247
-156
lines changed

_topic_maps/_topic_map.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,8 +1627,6 @@ Topics:
16271627
File: configuring-secondary-external-gateway
16281628
- Name: Configuring an egress IP address
16291629
File: configuring-egress-ips-ovn
1630-
- Name: Assigning an egress IP address
1631-
File: assigning-egress-ips-ovn
16321630
- Name: Configuring an egress service
16331631
File: configuring-egress-traffic-for-vrf-loadbalancer-services
16341632
- Name: Considerations for the use of an egress router pod

modules/nw-egress-ips-about.adoc

Lines changed: 7 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,13 @@
22
//
33
// * networking/ovn_kubernetes_network_provider/configuring-egress-ips-ovn.adoc
44

5-
ifeval::["{context}" == "configuring-egress-ips-ovn"]
6-
:ovn:
7-
endif::[]
8-
5+
:_mod-docs-content-type: REFERENCE
96
[id="nw-egress-ips-about_{context}"]
107
= Egress IP address architectural design and implementation
118

12-
The {product-title} egress IP address functionality allows you to ensure that the traffic from one or more pods in one or more namespaces has a consistent source IP address for services outside the cluster network.
13-
14-
For example, you might have a pod that periodically queries a database that is hosted on a server outside of your cluster. To enforce access requirements for the server, a packet filtering device is configured to allow traffic only from specific IP addresses.
15-
To ensure that you can reliably allow access to the server from only that specific pod, you can configure a specific egress IP address for the pod that makes the requests to the server.
9+
By using the {product-title} egress IP address functionality, you can ensure that the traffic from one or more pods in one or more namespaces has a consistent source IP address for services outside the cluster network.
1610

11+
For example, you might have a pod that periodically queries a database that is hosted on a server outside of your cluster. To enforce access requirements for the server, a packet filtering device is configured to allow traffic only from specific IP addresses. To ensure that you can reliably allow access to the server from only that specific pod, you can configure a specific egress IP address for the pod that makes the requests to the server.
1712

1813
An egress IP address assigned to a namespace is different from an egress router, which is used to send traffic to specific destinations.
1914

@@ -72,14 +67,14 @@ ifndef::openshift-rosa[]
7267
[id="nw-egress-ips-public-cloud-platform-considerations_{context}"]
7368
== Public cloud platform considerations
7469

75-
Typically, public cloud providers place a limit on egress IPs. This means that there is a constraint on the absolute number of assignable IP addresses per node for clusters provisioned on public cloud infrastructure. The maximum number of assignable IP addresses per node, or the _IP capacity_, can be described in the following formula:
70+
Typically, public cloud providers place a limit on egress IP addresses. This means that there is a constraint on the absolute number of assignable IP addresses per node for clusters provisioned on public cloud infrastructure. The maximum number of assignable IP addresses per node, or the _IP capacity_, can be described in the following formula:
7671

7772
[source,text]
7873
----
7974
IP capacity = public cloud default capacity - sum(current IP assignments)
8075
----
8176

82-
While the Egress IPs capability manages the IP address capacity per node, it is important to plan for this constraint in your deployments. For example, if a public cloud provider limits IP address capacity to 10 IP addresses per node, and you have 8 nodes, the total number of assignable IP addresses is only 80. To achieve a higher IP address capacity, you would need to allocate additional nodes. For example, if you needed 150 assignable IP addresses, you would need to allocate 7 additional nodes.
77+
While the Egress IP addresses capability manages the IP address capacity per node, it is important to plan for this constraint in your deployments. For example, if a public cloud provider limits IP address capacity to 10 IP addresses per node, and you have 8 nodes, the total number of assignable IP addresses is only 80. To achieve a higher IP address capacity, you would need to allocate additional nodes. For example, if you needed 150 assignable IP addresses, you would need to allocate 7 additional nodes.
8378

8479
To confirm the IP capacity and subnets for any node in your public cloud environment, you can enter the `oc get node <node_name> -o yaml` command. The `cloud.network.openshift.io/egress-ipconfig` annotation includes capacity and subnet information for the node.
8580

@@ -160,80 +155,8 @@ On Azure, the following capacity limits exist for IP address assignment:
160155

161156
For more information, see link:https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-subscription-service-limits?toc=/azure/virtual-network/toc.json#networking-limits[Networking limits].
162157

163-
ifdef::ovn[]
164-
[id="nw-egress-ips-multi-nic-considerations_{context}"]
165-
== Considerations for using an egress IP on additional network interfaces
166-
167-
In {product-title}, egress IPs provide administrators a way to control network traffic. Egress IPs can be used with a `br-ex` Open vSwitch (OVS) bridge interface and any physical interface that has IP connectivity enabled.
168-
169-
You can inspect your network interface type by running the following command:
170-
171-
[source,terminal]
172-
----
173-
$ ip -details link show
174-
----
175-
176-
The primary network interface is assigned a node IP address which also contains a subnet mask. Information for this node IP address can be retrieved from the Kubernetes node object for each node within your cluster by inspecting the `k8s.ovn.org/node-primary-ifaddr` annotation. In an IPv4 cluster, this annotation is similar to the following example: `"k8s.ovn.org/node-primary-ifaddr: {"ipv4":"192.168.111.23/24"}"`.
177-
178-
If the egress IP is not within the subnet of the primary network interface subnet, you can use an egress IP on another Linux network interface that is not of the primary network interface type. By doing so, {product-title} administrators are provided with a greater level of control over networking aspects such as routing, addressing, segmentation, and security policies. This feature provides users with the option to route workload traffic over specific network interfaces for purposes such as traffic segmentation or meeting specialized requirements.
179-
180-
If the egress IP is not within the subnet of the primary network interface, then the selection of another network interface for egress traffic might occur if they are present on a node.
181-
182-
You can determine which other network interfaces might support egress IPs by inspecting the `k8s.ovn.org/host-cidrs` Kubernetes node annotation. This annotation contains the addresses and subnet mask found for the primary network interface. It also contains additional network interface addresses and subnet mask information. These addresses and subnet masks are assigned to network interfaces that use the link:https://networklessons.com/cisco/ccna-200-301/longest-prefix-match-routing[longest prefix match routing] mechanism to determine which network interface supports the egress IP.
183-
184-
[NOTE]
185-
====
186-
OVN-Kubernetes provides a mechanism to control and direct outbound network traffic from specific namespaces and pods. This ensures that it exits the cluster through a particular network interface and with a specific egress IP address.
187-
====
188-
189-
190-
[id="nw-egress-ips-multi-nic-requirements_{context}"]
191-
=== Requirements for assigning an egress IP to a network interface that is not the primary network interface
192-
193-
For users who want an egress IP and traffic to be routed over a particular interface that is not the primary network interface, the following conditions must be met:
194-
195-
* {product-title} is installed on a bare-metal cluster. This feature is disabled within a cloud or a hypervisor environment.
196-
197-
* Your {product-title} pods are not configured as _host-networked_.
198-
199-
* If a network interface is removed or if the IP address and subnet mask which allows the egress IP to be hosted on the interface is removed, the egress IP is reconfigured. Consequently, the egress IP could be assigned to another node and interface.
200-
201-
* If you use an Egress IP address on a secondary network interface card (NIC), you must use the Node Tuning Operator to enable IP forwarding on the secondary NIC.
202-
endif::ovn[]
203158
endif::openshift-rosa[]
204159

205-
ifdef::ovn[]
206-
[id="nw-egress-ips-considerations_{context}"]
207-
== Assignment of egress IPs to pods
208-
209-
To assign one or more egress IPs to a namespace or specific pods in a namespace, the following conditions must be satisfied:
210-
211-
- At least one node in your cluster must have the `k8s.ovn.org/egress-assignable: ""` label.
212-
- An `EgressIP` object exists that defines one or more egress IP addresses to use as the source IP address for traffic leaving the cluster from pods in a namespace.
213-
214-
[IMPORTANT]
215-
====
216-
If you create `EgressIP` objects prior to labeling any nodes in your cluster for egress IP assignment, {product-title} might assign every egress IP address to the first node with the `k8s.ovn.org/egress-assignable: ""` label.
217-
218-
To ensure that egress IP addresses are widely distributed across nodes in the cluster, always apply the label to the nodes you intent to host the egress IP addresses before creating any `EgressIP` objects.
219-
====
220-
221-
[id="nw-egress-ips-node-assignment_{context}"]
222-
== Assignment of egress IPs to nodes
223-
224-
When creating an `EgressIP` object, the following conditions apply to nodes that are labeled with the `k8s.ovn.org/egress-assignable: ""` label:
225-
226-
- An egress IP address is never assigned to more than one node at a time.
227-
- An egress IP address is equally balanced between available nodes that can host the egress IP address.
228-
- If the `spec.EgressIPs` array in an `EgressIP` object specifies more than one IP address, the following conditions apply:
229-
* No node will ever host more than one of the specified IP addresses.
230-
* Traffic is balanced roughly equally between the specified IP addresses for a given namespace.
231-
- If a node becomes unavailable, any egress IP addresses assigned to it are automatically reassigned, subject to the previously described conditions.
232-
233-
When a pod matches the selector for multiple `EgressIP` objects, there is no guarantee which of the egress IP addresses that are specified in the `EgressIP` objects is assigned as the egress IP address for the pod.
234-
235-
Additionally, if an `EgressIP` object specifies multiple egress IP addresses, there is no guarantee which of the egress IP addresses might be used. For example, if a pod matches a selector for an `EgressIP` object with two egress IP addresses, `10.10.20.1` and `10.10.20.2`, either might be used for each TCP connection or UDP conversation.
236-
237160
[id="nw-egress-ips-node-architecture_{context}"]
238161
== Architectural diagram of an egress IP address configuration
239162

@@ -246,12 +169,7 @@ Both Node 1 and Node 3 are labeled with `k8s.ovn.org/egress-assignable: ""` and
246169

247170
The dashed lines in the diagram depict the traffic flow from pod1, pod2, and pod3 traveling through the pod network to egress the cluster from Node 1 and Node 3. When an external service receives traffic from any of the pods selected by the example `EgressIP` object, the source IP address is either `192.168.126.10` or `192.168.126.102`. The traffic is balanced roughly equally between these two nodes.
248171

249-
The following resources from the diagram are illustrated in detail:
250-
251-
`Namespace` objects::
252-
+
253-
--
254-
The namespaces are defined in the following manifest:
172+
Based on the diagram, the following manifest file defines namespaces:
255173

256174
.Namespace objects
257175
[source,yaml]
@@ -270,12 +188,8 @@ metadata:
270188
labels:
271189
env: prod
272190
----
273-
--
274191

275-
`EgressIP` object::
276-
+
277-
--
278-
The following `EgressIP` object describes a configuration that selects all pods in any namespace with the `env` label set to `prod`. The egress IP addresses for the selected pods are `192.168.126.10` and `192.168.126.102`.
192+
Based on the diagram, the following `EgressIP` object describes a configuration that selects all pods in any namespace with the `env` label set to `prod`. The egress IP addresses for the selected pods are `192.168.126.10` and `192.168.126.102`.
279193

280194
.`EgressIP` object
281195
[source,yaml]
@@ -300,9 +214,3 @@ status:
300214
----
301215

302216
For the configuration in the previous example, {product-title} assigns both egress IP addresses to the available nodes. The `status` field reflects whether and where the egress IP addresses are assigned.
303-
--
304-
endif::ovn[]
305-
306-
ifdef::ovn[]
307-
:!ovn:
308-
endif::ovn[]

modules/nw-egress-ips-assign.adoc

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module included in the following assemblies:
22
//
3-
// * networking/ovn_kubernetes_network_provider/assigning-egress-ips-ovn.adoc
3+
// * networking/ovn_kubernetes_network_provider/configuring-egress-ips-ovn.adoc
44

55
:_mod-docs-content-type: PROCEDURE
66
[id="nw-egress-ips-assign_{context}"]
@@ -16,8 +16,10 @@ You can assign one or more egress IP addresses to a namespace or to specific pod
1616
1717
.Procedure
1818

19-
. Create an `EgressIP` object:
19+
. Create an `EgressIP` object.
20+
+
2021
.. Create a `<egressips_name>.yaml` file where `<egressips_name>` is the name of the object.
22+
+
2123
.. In the file that you created, define an `EgressIP` object, as in the following example:
2224
+
2325
[source,yaml]
@@ -39,9 +41,14 @@ spec:
3941
+
4042
[source,terminal]
4143
----
42-
$ oc apply -f <egressips_name>.yaml <1>
44+
$ oc apply -f <egressips_name>.yaml
4345
----
44-
<1> Replace `<egressips_name>` with the name of the object.
46+
+
47+
--
48+
where:
49+
50+
`<egressips_name>`:: Replace `<egressips_name>` with the name of the object.
51+
--
4552
+
4653
.Example output
4754
[source,terminal]
@@ -55,13 +62,18 @@ egressips.k8s.ovn.org/<egressips_name> created
5562
+
5663
[source,terminal]
5764
----
58-
$ oc label ns <namespace> env=qa <1>
65+
$ oc label ns <namespace> env=qa
5966
----
60-
<1> Replace `<namespace>` with the namespace that requires egress IP addresses.
67+
+
68+
--
69+
where:
70+
71+
`<namespace>`:: Replace `<namespace>` with the namespace that requires egress IP addresses.
72+
--
6173

6274
.Verification
6375

64-
* To show all egress IPs that are in use in your cluster, enter the following command:
76+
* To show all egress IP addresses that are in use in your cluster, enter the following command:
6577
+
6678
[source,terminal]
6779
----

modules/nw-egress-ips-config-object.adoc

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Module included in the following assemblies:
22
//
3-
// * networking/ovn_kubernetes_network_provider/assigning-egress-ips-ovn.adoc
3+
// * networking/ovn_kubernetes_network_provider/configuring-egress-ips-ovn.adoc
44

5+
:_mod-docs-content-type: CONCEPT
56
[id="nw-egress-ips-config-object_{context}"]
67
= The egressIPConfig object
78

@@ -25,11 +26,17 @@ spec:
2526
hostPrefix: 23
2627
defaultNetwork:
2728
ovnKubernetesConfig:
28-
egressIPConfig: <1>
29-
reachabilityTotalTimeoutSeconds: 5 <2>
29+
egressIPConfig:
30+
reachabilityTotalTimeoutSeconds: 5
3031
gatewayConfig:
3132
routingViaHost: false
3233
genevePort: 6081
3334
----
34-
<1> The `egressIPConfig` holds the configurations for the options of the `EgressIP` object. By changing these configurations, you can extend the `EgressIP` object.
35-
<2> The value for `reachabilityTotalTimeoutSeconds` accepts integer values from `0` to `60`. A value of `0` disables the reachability check of the egressIP node. Setting a value from `1` to `60` corresponds to the timeout in seconds for a probe to send the reachability check to the node.
35+
36+
--
37+
where:
38+
39+
`<egressIPConfig>`:: The `egressIPConfig` holds the configurations for the options of the `EgressIP` object. By changing these configurations, you can extend the `EgressIP` object.
40+
41+
`<reachabilityTotalTimeoutSeconds>`:: The value for `reachabilityTotalTimeoutSeconds` accepts integer values from `0` to `60`. A value of `0` disables the reachability check of the egressIP node. Setting a value from `1` to `60` corresponds to the timeout in seconds for a probe to send the reachability check to the node.
42+
--
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * networking/ovn_kubernetes_network_provider/configuring-egress-ips-ovn.adoc
4+
5+
:_mod-docs-content-type: REFERENCE
6+
[id="nw-egress-ips-considerations_{context}"]
7+
= Assignment of egress IPs to a namespace, nodes, and pods
8+
9+
To assign one or more egress IPs to a namespace or specific pods in a namespace, the following conditions must be satisfied:
10+
11+
- At least one node in your cluster must have the `k8s.ovn.org/egress-assignable: ""` label.
12+
- An `EgressIP` object exists that defines one or more egress IP addresses to use as the source IP address for traffic leaving the cluster from pods in a namespace.
13+
14+
[IMPORTANT]
15+
====
16+
If you create `EgressIP` objects prior to labeling any nodes in your cluster for egress IP assignment, {product-title} might assign every egress IP address to the first node with the `k8s.ovn.org/egress-assignable: ""` label.
17+
18+
To ensure that egress IP addresses are widely distributed across nodes in the cluster, always apply the label to the nodes you intent to host the egress IP addresses before creating any `EgressIP` objects.
19+
====
20+
21+
When creating an `EgressIP` object, the following conditions apply to nodes that are labeled with the `k8s.ovn.org/egress-assignable: ""` label:
22+
23+
- An egress IP address is never assigned to more than one node at a time.
24+
- An egress IP address is equally balanced between available nodes that can host the egress IP address.
25+
- If the `spec.EgressIPs` array in an `EgressIP` object specifies more than one IP address, the following conditions apply:
26+
* No node will ever host more than one of the specified IP addresses.
27+
* Traffic is balanced roughly equally between the specified IP addresses for a given namespace.
28+
- If a node becomes unavailable, any egress IP addresses assigned to it are automatically reassigned, subject to the previously described conditions.
29+
30+
When a pod matches the selector for multiple `EgressIP` objects, there is no guarantee which of the egress IP addresses that are specified in the `EgressIP` objects is assigned as the egress IP address for the pod.
31+
32+
Additionally, if an `EgressIP` object specifies multiple egress IP addresses, there is no guarantee which of the egress IP addresses might be used. For example, if a pod matches a selector for an `EgressIP` object with two egress IP addresses, `10.10.20.1` and `10.10.20.2`, either might be used for each TCP connection or UDP conversation.

0 commit comments

Comments
 (0)