Skip to content

Commit a997dc7

Browse files
committed
chore: review adding gw section
Signed-off-by: Pau Capdevila <[email protected]>
1 parent 03f5d6a commit a997dc7

File tree

1 file changed

+89
-66
lines changed

1 file changed

+89
-66
lines changed

docs/user-guide/gateway-add.md

Lines changed: 89 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Two types of resources must be created in the running cluster:
2525

2626
Additionally, for building the gateway installer:
2727

28-
3. **FabNode** - Defines the gateway node at the fabricator level (required for `hhfab build --gateways`)
28+
3. **FabNode** - Defines the gateway node at the fabricator level (required for `hhfab build --gateways`). See [Install Gateway Node](../install-upgrade/install.md#install-gateway-node) for details on installing the bare metal machine.
2929

3030
## Step 1: Gather Configuration Values
3131

@@ -44,13 +44,14 @@ Example configuration:
4444
```yaml
4545
config:
4646
control:
47-
managementSubnet: 172.30.30.0/24
48-
dummySubnet: 172.30.50.0/24
47+
managementSubnet: 172.30.0.0/21
48+
controlVIP: 172.30.0.1
49+
dummySubnet: 172.30.90.0/24
4950
fabric:
50-
managementDHCPStart: 172.30.30.10
51-
protocolSubnet: 172.30.40.0/24
52-
vtepSubnet: 172.30.41.0/24
53-
fabricSubnet: 172.30.42.0/24
51+
managementDHCPStart: 172.30.4.0
52+
protocolSubnet: 172.30.8.0/24
53+
vtepSubnet: 172.30.12.0/24
54+
fabricSubnet: 172.30.128.0/24
5455
gateway:
5556
asn: 65534
5657
```
@@ -92,8 +93,9 @@ Example: If management subnet is 172.30.0.0/21 and DHCP starts at 172.30.4.0, ch
9293

9394
### Dummy IP
9495

95-
The dummy IP is used for internal K3s cluster communication between control and gateway nodes. Each node requires a unique /31
96-
subnet from the dummy subnet range. The /31 provides a point-to-point link between the node and the control plane.
96+
The dummy IP is used for internal K3s cluster communication between control and gateway nodes. We use dummy network devices
97+
and IPs to ensure K3s has a stable default network route. Each node requires a unique /31 subnet from the dummy subnet range.
98+
The /31 provides a point-to-point link between the node and the control plane.
9799

98100
Verify uniqueness by checking existing allocations:
99101

@@ -113,23 +115,23 @@ Example: If dummy subnet is 172.30.90.0/24, and control-1 uses 172.30.90.0/31, c
113115

114116
### Protocol IP
115117

116-
Unique /32 from protocol subnet.
118+
Unique /32 from protocol subnet (`config.fabric.protocolSubnet`).
117119

118-
Example: 172.30.8.3/32
120+
Example: 172.30.8.3/32 (from 172.30.8.0/24)
119121

120122
### VTEP IP
121123

122-
Unique /32 from VTEP subnet.
124+
Unique /32 from VTEP subnet (`config.fabric.vtepSubnet`).
123125

124-
Example: 172.30.12.3/32
126+
Example: 172.30.12.3/32 (from 172.30.12.0/24)
125127

126128
### Fabric Link IPs
127129

128-
Unique /31 pairs from fabric subnet (one pair per uplink).
130+
Unique /31 pairs from fabric subnet (`config.fabric.fabricSubnet`, one pair per uplink).
129131

130-
Example for two uplinks:
131-
- Spine-01 link: Switch 172.30.42.0/31, Gateway 172.30.42.1/31
132-
- Spine-02 link: Switch 172.30.42.2/31, Gateway 172.30.42.3/31
132+
Example for two uplinks (from 172.30.128.0/24):
133+
- Leaf-01 link: Switch 172.30.128.0/31, Gateway 172.30.128.1/31
134+
- Leaf-02 link: Switch 172.30.128.10/31, Gateway 172.30.128.11/31
133135

134136
Check existing gateway connection IPs:
135137

@@ -142,49 +144,59 @@ kubectl get connections -o custom-columns=NAME:.metadata.name,SWITCH_IP:.spec.ga
142144
Gateway connections must be created before the Gateway resource. Connections establish uplinks to Fabric switches and define
143145
the IP addresses used by gateway interfaces. For spine-leaf topology, connect to spines. For mesh topology, connect to leaves.
144146

145-
Apply the Connection resources to the cluster:
147+
Create a YAML file with your Connection resources:
146148

147-
```bash
148-
kubectl apply -f - <<'EOF'
149+
```{.yaml .annotate linenums="1" title="gateway-connections.yaml"}
149150
apiVersion: wiring.githedgehog.com/v1beta1
150151
kind: Connection
151152
metadata:
152-
name: leaf-01--gateway--gateway-1
153+
name: leaf-01--gateway--gateway-1 # (1)!
153154
namespace: default
154155
spec:
155156
gateway:
156157
links:
157158
- switch:
158-
port: leaf-01/E1/8
159-
ip: 172.30.128.0/31
159+
port: leaf-01/E1/8 # (2)!
160+
ip: 172.30.128.0/31 # (3)!
160161
gateway:
161-
port: gateway-1/enp2s1
162-
ip: 172.30.128.1/31
162+
port: gateway-1/enp2s1 # (4)!
163+
ip: 172.30.128.1/31 # (5)!
163164
---
164165
apiVersion: wiring.githedgehog.com/v1beta1
165166
kind: Connection
166167
metadata:
167-
name: leaf-02--gateway--gateway-1
168+
name: leaf-02--gateway--gateway-1 # (6)!
168169
namespace: default
169170
spec:
170171
gateway:
171172
links:
172173
- switch:
173-
port: leaf-02/E1/9
174-
ip: 172.30.128.10/31
174+
port: leaf-02/E1/9 # (7)!
175+
ip: 172.30.128.10/31 # (8)!
175176
gateway:
176-
port: gateway-1/enp2s2
177-
ip: 172.30.128.11/31
178-
EOF
177+
port: gateway-1/enp2s2 # (9)!
178+
ip: 172.30.128.11/31 # (10)!
179179
```
180180

181-
Key points:
181+
1. Connection name - we typically use the pattern `<switch>--gateway--<gateway>` but any name will work
182+
2. Switch port must be a valid port on the switch (see [Switch Profiles](profiles.md))
183+
3. Allocate a unique /31 IP from `config.fabric.fabricSubnet` for the switch side
184+
4. Gateway physical network interface name (will be referenced in Gateway resource)
185+
5. Allocate the paired /31 IP from `config.fabric.fabricSubnet` for the gateway side
186+
6. Connection name for the second uplink
187+
7. Switch port for the second uplink
188+
8. Allocate another unique /31 IP pair from `config.fabric.fabricSubnet` for the switch side
189+
9. Gateway physical network interface name for the second uplink
190+
10. Allocate the paired /31 IP for the gateway side
191+
192+
Apply the Connection resources to the cluster:
193+
194+
```bash
195+
kubectl apply -f gateway-connections.yaml
196+
```
182197

183-
* Each link requires a /31 IP pair from fabricSubnet
184-
* Gateway port names will be referenced in the Gateway resource
185-
* Switch port must be a valid port on the switch (see [Switch Profiles](profiles.md))
186-
* Connection name follows pattern: `<switch>--gateway--<gateway>`
187-
* Connections must be in `default` namespace
198+
!!! note
199+
Connections must be created in the `default` namespace and must be applied before the Gateway resource.
188200

189201
## Step 4: Create Gateway Resource
190202

@@ -197,50 +209,61 @@ First, determine the BGP ASNs of the switches you're connecting to:
197209
kubectl get switches -o custom-columns=NAME:.metadata.name,ASN:.spec.asn
198210
```
199211

200-
Then apply the Gateway resource:
212+
Create a YAML file with your Gateway resource:
201213

202-
```bash
203-
kubectl apply -f - <<'EOF'
214+
```{.yaml .annotate linenums="1" title="gateway.yaml"}
204215
apiVersion: gateway.githedgehog.com/v1alpha1
205216
kind: Gateway
206217
metadata:
207218
name: gateway-1
208219
namespace: fab
209220
spec:
210-
asn: 65534
211-
protocolIP: 172.30.8.3/32
212-
vtepIP: 172.30.12.3/32
213-
vtepMAC: CA:FE:BA:BE:01:02
221+
asn: 65534 # (1)!
222+
protocolIP: 172.30.8.3/32 # (2)!
223+
vtepIP: 172.30.12.3/32 # (3)!
224+
vtepMAC: 02:00:00:00:01:02 # (4)!
214225
interfaces:
215-
enp2s1:
226+
enp2s1: # (5)!
216227
ips:
217-
- 172.30.128.1/31
218-
enp2s2:
228+
- 172.30.128.1/31 # (6)!
229+
enp2s2: # (7)!
219230
ips:
220-
- 172.30.128.11/31
231+
- 172.30.128.11/31 # (8)!
221232
neighbors:
222-
- asn: 65101
223-
ip: 172.30.128.0
224-
source: enp2s1
225-
- asn: 65102
226-
ip: 172.30.128.10
227-
source: enp2s2
228-
workers: 8
229-
EOF
233+
- asn: 65101 # (9)!
234+
ip: 172.30.128.0 # (10)!
235+
source: enp2s1 # (11)!
236+
- asn: 65102 # (12)!
237+
ip: 172.30.128.10 # (13)!
238+
source: enp2s2 # (14)!
239+
workers: 8 # (15)!
230240
```
231241

232-
Key fields:
242+
1. Must match `config.gateway.asn` from Fabricator configuration (use `kubectl get fabricator -n fab -o jsonpath='{.items[0].spec.config.gateway.asn}'`)
243+
2. Allocate a unique /32 from `config.fabric.protocolSubnet` (BGP router ID)
244+
3. Allocate a unique /32 from `config.fabric.vtepSubnet` (VXLAN tunnel endpoint)
245+
4. MAC address for VTEP - any valid MAC address (e.g., 02:00:00:00:01:02)
246+
5. Interface name must match the physical network interface on the gateway hardware and the `gateway.port` in the Connection resource
247+
6. Must match the `gateway.ip` from the corresponding Connection resource (gateway-connections.yaml line 11)
248+
7. Interface name for the second uplink
249+
8. Must match the `gateway.ip` from the corresponding Connection resource (gateway-connections.yaml line 26)
250+
9. Switch ASN - get from `kubectl get switches -o custom-columns=NAME:.metadata.name,ASN:.spec.asn` for leaf-01
251+
10. Must match the `switch.ip` from the corresponding Connection resource (gateway-connections.yaml line 10)
252+
11. Must match the interface name defined above
253+
12. Switch ASN for the second uplink - get from `kubectl get switches` for leaf-02
254+
13. Must match the `switch.ip` from the corresponding Connection resource (gateway-connections.yaml line 25)
255+
14. Must match the interface name for the second uplink
256+
15. Number of dataplane worker threads (typically 8)
257+
258+
Apply the Gateway resource to the cluster:
233259

234-
* `asn` - Must match `config.gateway.asn` from Fabricator configuration (typically 65534)
235-
* `protocolIP` - Unique /32 from protocol subnet for BGP router ID
236-
* `vtepIP` - Unique /32 from VTEP subnet for VXLAN tunnel endpoint
237-
* `vtepMAC` - MAC address for VTEP (use format CA:FE:BA:BE:XX:XX with unique last two octets)
238-
* `interfaces` - Each interface must have IPs matching the gateway side of the Connections
239-
* `neighbors` - BGP neighbors with switch ASNs and IPs from switch side of Connections
240-
* `workers` - Number of dataplane worker threads (typically 8)
260+
```bash
261+
kubectl apply -f gateway.yaml
262+
```
241263

242-
The interface names (enp2s1, enp2s2) must match physical network interfaces on the gateway hardware. For kernel driver
243-
(default), use standard Linux interface names. For DPDK driver, configure PCI addresses.
264+
!!! note
265+
The interface names (enp2s1, enp2s2) must match physical network interfaces on the gateway hardware. For kernel driver
266+
(default), use standard Linux interface names. For DPDK driver, configure PCI addresses.
244267

245268
## Installing the Gateway Node
246269

0 commit comments

Comments
 (0)