Skip to content

Commit bcfa842

Browse files
committed
Document Metallb IP assignment
1 parent 994f92f commit bcfa842

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

docs/envoy-gateway-setup.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,92 @@ envoyProxy:
160160

161161
Adjust this section for a different cluster. On cloud providers, this may be replaced by provider-specific load balancer annotations or omitted entirely.
162162

163+
## MetalLB IP Assignment
164+
165+
The following values describe the current production Theia cluster. Treat them as an example of the pattern, not as universal defaults. Other deployments must use their own MetalLB pools, external IPs, DNS records, and load-balancer annotations.
166+
167+
In the current Artemis cluster, MetalLB exposes two single-address pools:
168+
169+
| Pool | Address | DNS label on the pool | Current purpose |
170+
| --- | --- | --- | --- |
171+
| `general` | `131.159.88.81/32` | `k8s-theia-lb0.aet.cit.tum.de` | general load balancer pool, not assigned to Envoy Gateway |
172+
| `ingress` | `131.159.88.82/32` | `k8s-theia-lb1.aet.cit.tum.de` | Envoy Gateway ingress pool |
173+
174+
The production Theia DNS names in this cluster resolve to `k8s-theia-lb1.aet.cit.tum.de`, which resolves to `131.159.88.82`. Therefore this deployment's Envoy Gateway data-plane service must receive `131.159.88.82`, not the other MetalLB address.
175+
176+
The general procedure is to choose the MetalLB pool and external address that DNS points to, then encode that choice in the shared gateway values. In this production setup, that is enforced through the shared gateway production values, not by manually editing the generated service. The `theia-shared-gateway` chart creates an Envoy Gateway `EnvoyProxy` resource with:
177+
178+
```yaml
179+
envoyProxy:
180+
create: true
181+
name: theia-shared-gateway
182+
namespace: envoy-gateway-system
183+
spec:
184+
provider:
185+
type: Kubernetes
186+
kubernetes:
187+
envoyService:
188+
annotations:
189+
metallb.io/address-pool: ingress
190+
metallb.io/loadBalancerIPs: 131.159.88.82
191+
externalTrafficPolicy: Local
192+
type: LoadBalancer
193+
```
194+
195+
Envoy Gateway reads this `EnvoyProxy` configuration and creates the actual data-plane service in `envoy-gateway-system`. The live service is named like:
196+
197+
```text
198+
envoy-gateway-system-theia-shared-gateway-74c11d26
199+
```
200+
201+
That service is generated and managed by Envoy Gateway. It currently has these relevant annotations and status:
202+
203+
```yaml
204+
metadata:
205+
annotations:
206+
metallb.io/address-pool: ingress
207+
metallb.io/ip-allocated-from-pool: ingress
208+
metallb.io/loadBalancerIPs: 131.159.88.82
209+
spec:
210+
type: LoadBalancer
211+
clusterIP: 198.19.125.184
212+
externalTrafficPolicy: Local
213+
status:
214+
loadBalancer:
215+
ingress:
216+
- ip: 131.159.88.82
217+
```
218+
219+
The `clusterIP` is only the internal Kubernetes service address. Public DNS must point to the MetalLB-assigned LoadBalancer address in `status.loadBalancer.ingress`, not to the internal `clusterIP`.
220+
221+
The `metallb.io/address-pool: ingress` annotation selects the MetalLB pool. The `metallb.io/loadBalancerIPs: 131.159.88.82` annotation pins the exact address from that pool. MetalLB then records the actual allocation with `metallb.io/ip-allocated-from-pool: ingress` and publishes the address in the service status.
222+
223+
Do not rely on MetalLB auto-assignment when the public DNS name must target a specific address. In the production cluster, both pools have `autoAssign: true`, so without the explicit EnvoyProxy annotations a new LoadBalancer service could receive the wrong address. If Envoy Gateway receives `131.159.88.81` while public DNS points at `131.159.88.82`, Theia hostnames will resolve to an address that is not serving the Gateway.
224+
225+
For a different deployment, adapt all of the following together:
226+
227+
- the MetalLB `IPAddressPool` name
228+
- the exact external IP requested through `metallb.io/loadBalancerIPs`
229+
- the DNS `A` / `AAAA` records for the public Theia hostnames
230+
- the shared gateway `EnvoyProxy` load-balancer annotations
231+
- any provider-specific load balancer annotations if the cluster does not use MetalLB
232+
233+
Use these checks after installing or changing the shared gateway:
234+
235+
```bash
236+
kubectl get ipaddresspools.metallb.io -n metallb-system
237+
kubectl get l2advertisements.metallb.io -n metallb-system
238+
kubectl get envoyproxy theia-shared-gateway -n envoy-gateway-system -o yaml
239+
kubectl get svc -n envoy-gateway-system -o wide
240+
kubectl get svc -n envoy-gateway-system \
241+
-l gateway.envoyproxy.io/owning-gateway-name=theia-shared-gateway \
242+
-o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.annotations.metallb\.io/address-pool}{"\t"}{.metadata.annotations.metallb\.io/loadBalancerIPs}{"\t"}{.status.loadBalancer.ingress[*].ip}{"\n"}{end}'
243+
dig +short theia.artemis.cit.tum.de A
244+
dig +short k8s-theia-lb1.aet.cit.tum.de A
245+
```
246+
247+
In the current Artemis production setup, the expected result is that the Envoy Gateway LoadBalancer service and the public DNS chain both end at `131.159.88.82`. In another deployment, the same check should end at that deployment's chosen public load-balancer address.
248+
163249
## Configure Tenant Theia Releases
164250

165251
Each tenant environment should attach its routes to the shared Gateway instead of creating a namespace-local Gateway:

0 commit comments

Comments
 (0)