You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
= Egress IP address architectural design and implementation
11
8
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.
16
10
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.
17
12
18
13
An egress IP address assigned to a namespace is different from an egress router, which is used to send traffic to specific destinations.
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:
76
71
77
72
[source,text]
78
73
----
79
74
IP capacity = public cloud default capacity - sum(current IP assignments)
80
75
----
81
76
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.
83
78
84
79
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.
85
80
@@ -160,80 +155,8 @@ On Azure, the following capacity limits exist for IP address assignment:
160
155
161
156
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].
== 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.
=== 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[]
203
158
endif::openshift-rosa[]
204
159
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
-
237
160
[id="nw-egress-ips-node-architecture_{context}"]
238
161
== Architectural diagram of an egress IP address configuration
239
162
@@ -246,12 +169,7 @@ Both Node 1 and Node 3 are labeled with `k8s.ovn.org/egress-assignable: ""` and
246
169
247
170
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.
248
171
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:
255
173
256
174
.Namespace objects
257
175
[source,yaml]
@@ -270,12 +188,8 @@ metadata:
270
188
labels:
271
189
env: prod
272
190
----
273
-
--
274
191
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`.
279
193
280
194
.`EgressIP` object
281
195
[source,yaml]
@@ -300,9 +214,3 @@ status:
300
214
----
301
215
302
216
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.
<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.
= 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