Skip to content

Commit e0ff960

Browse files
committed
OSDOCS-10661:updates for local gateway mode
1 parent 8882c02 commit e0ff960

File tree

4 files changed

+107
-1
lines changed

4 files changed

+107
-1
lines changed

_topic_maps/_topic_map.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1605,6 +1605,8 @@ Topics:
16051605
File: converting-to-dual-stack
16061606
- Name: Configuring internal subnets
16071607
File: configure-ovn-kubernetes-subnets
1608+
- Name: Configuring gateway mode
1609+
File: configuring-gateway-mode
16081610
- Name: Configure an external gateway on the default network
16091611
File: configuring-secondary-external-gateway
16101612
- Name: Configuring an egress IP address

modules/nw-operator-cr.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ endif::operator[]
206206

207207
|`gatewayConfig`
208208
|`object`
209-
|Optional: Specify a configuration object for customizing how egress traffic is sent to the node gateway.
209+
|Optional: Specify a configuration object for customizing how egress traffic is sent to the node gateway. Valid values are `Shared` and `Local`. The default value is `Shared`. In the default setting, the Open vSwitch (OVS) outputs traffic directly to the node IP interface. In the `Local` setting, it traverses the host network; consequently, it gets applied to the routing table of the host.
210210

211211
[NOTE]
212212
====

modules/nwt-gateway-mode.adoc

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// Module included in the following assemblies:
2+
//
3+
4+
:_mod-docs-content-type: PROCEDURE
5+
[id="nwt-gateway-mode_{context}"]
6+
= Setting local and shared gateway modes
7+
8+
As a cluster administrator you can configure the gateway mode using the `gatewayConfig` spec in the Cluster Network Operator. The following procedure can be used to set the `routingViaHost` field to `true` for local mode or `false` for shared mode.
9+
10+
You can follow the optional step 4 to enable IP forwarding alongside local gateway mode if you need the host network of the node to act as a router for traffic not related to OVN-Kubernetes. For example, possible use cases for combining local gateway mode with IP forwarding include:
11+
12+
* Configuring all pod egress traffic to be forwarded via the node's IP
13+
14+
* Integrating OVN-Kubernetes CNI with external network address translation (NAT) devices
15+
16+
* Configuring OVN-Kubernetes CNI to use a kernel routing table
17+
18+
19+
.Prerequisites
20+
* You are logged in as a user with admin privileges.
21+
22+
.Procedure
23+
24+
. Back up the existing network configuration by running the following command:
25+
+
26+
[source,terminal]
27+
----
28+
$ oc get network.operator cluster -o yaml > network-config-backup.yaml
29+
----
30+
31+
. Set the `routingViaHost` paramemter to `true` for local gateway mode by running the following command:
32+
+
33+
[source,terminal]
34+
----
35+
$ oc patch networks.operator.openshift.io cluster --type=merge -p '{"spec":{"defaultNetwork":{"ovnKubernetesConfig":{"gatewayConfig":{"routingViaHost": true}}}}}'
36+
----
37+
38+
. Verify that local gateway mode has been set by running the following command:
39+
+
40+
[source,terminal]
41+
----
42+
$ oc get networks.operator.openshift.io cluster -o yaml | grep -A 5 "gatewayConfig"
43+
----
44+
+
45+
.Example output
46+
[source,terminal]
47+
----
48+
apiVersion: operator.openshift.io/v1
49+
kind: Network
50+
metadata:
51+
name: cluster
52+
# ...
53+
gatewayConfig:
54+
ipv4: {}
55+
ipv6: {}
56+
routingViaHost: true <1>
57+
genevePort: 6081
58+
ipsecConfig:
59+
# ...
60+
----
61+
<1> A value of `true` sets local gateway mode and a value of `false` sets shared gateway mode. In local gateway mode, traffic is routed through the host. In shared gateway mode, traffic is not routed through the host.
62+
63+
. Optional: Enable IP forwarding globally by running the following command:
64+
+
65+
[source,terminal]
66+
----
67+
$ oc patch network.operator cluster --type=merge -p '{"spec":{"defaultNetwork":{"ovnKubernetesConfig":{"gatewayConfig":{"ipForwarding": "Global"}}}}}'
68+
----
69+
.. Verify that the `ipForwarding` spec has been set to `Global` by running the following command:
70+
+
71+
[source,terminal]
72+
----
73+
$ oc get networks.operator.openshift.io cluster -o yaml | grep -A 5 "gatewayConfig"
74+
----
75+
+
76+
.Example output
77+
[source,terminal]
78+
----
79+
apiVersion: operator.openshift.io/v1
80+
kind: Network
81+
metadata:
82+
name: cluster
83+
# ...
84+
gatewayConfig:
85+
ipForwarding: Global
86+
ipv4: {}
87+
ipv6: {}
88+
routingViaHost: true
89+
genevePort: 6081
90+
# ...
91+
----
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
:_mod-docs-content-type: ASSEMBLY
2+
[id="configuring-gateway-mode"]
3+
= Configuring gateway mode
4+
include::_attributes/common-attributes.adoc[]
5+
:context: configuring-gateway-mode
6+
7+
toc::[]
8+
9+
As a cluster administrator you can configure the `gatewayConfig` object to manage how external traffic leaves the cluster. You do so by setting the `routingViaHost` spec to `true` for local mode or `false` for shared mode.
10+
11+
In local gateway mode, traffic is routed through the host and is consequently applied to the routing table of the host. In shared gateway mode, traffic is not routed through the host. Instead, traffic the Open vSwitch (OVS) outputs traffic directly to the node IP interface.
12+
13+
include::modules/nwt-gateway-mode.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)