Skip to content

Commit ef95af0

Browse files
committed
add doc about how to specify vip in gateway
1 parent dd21839 commit ef95af0

2 files changed

Lines changed: 52 additions & 2 deletions

File tree

docs/en/configure/networking/functions/configure_gatewayapi_gateway.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ In YAML, this setting is configured in the companion `EnvoyProxy` resource at
4949
The advantage is ease of use and high-availability load balancing capabilities.
5050
To use LoadBalancer, the cluster must have LoadBalancer support, which can be enabled via [MetalLB](./configure_metallb.mdx#configure_ip_pool).
5151

52+
When using MetalLB, you can specify a static VIP through service annotations. In the Web Console, use the **Service Annotation** field:
53+
54+
```yaml
55+
metallb.universe.tf/address-pool: ADDRESS_POOL_NAME
56+
# Or specify a specific IP directly
57+
metallb.universe.tf/loadBalancerIPs: VIP_IP
58+
```
59+
60+
For more details, see [How To Specify a VIP When Using MetalLB](../how_to/tasks_for_envoy_gateway.mdx#specify_vip_metallb).
61+
5262
#### NodePort \{#access_gateway_via_nodeport}
5363
5464
The advantage is that it doesn't require any external dependencies.

docs/en/configure/networking/how_to/tasks_for_envoy_gateway.mdx

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,46 @@ spec:
151151
NodePort can only be within a specific range, typically `30000-32767`. If you want the Gateway listener port and NodePort to be consistent, your listener port must also be within the NodePort range.
152152
:::
153153

154+
### How To Specify a VIP When Using MetalLB \{#specify_vip_metallb}
155+
156+
When using MetalLB as the LoadBalancer provider, you can specify a static VIP for the Gateway service through service annotations.
157+
158+
```yaml
159+
apiVersion: gateway.envoyproxy.io/v1alpha1
160+
kind: EnvoyProxy
161+
metadata:
162+
name: demo
163+
namespace: demo
164+
spec:
165+
provider:
166+
type: Kubernetes
167+
kubernetes:
168+
envoyService:
169+
type: LoadBalancer
170+
annotations: # [!code callout]
171+
metallb.universe.tf/address-pool: production # [!code callout]
172+
metallb.universe.tf/loadBalancerIPs: VIP_IP # [!code callout]
173+
```
174+
175+
<Callouts>
176+
1. Add MetalLB annotations in the `envoyService.annotations` field
177+
2. Specify the address pool name to allocate IP from
178+
3. Or specify a specific IP address (must be within the address pool range)
179+
</Callouts>
180+
181+
**Available Annotations:**
182+
183+
| Annotation | Description |
184+
| ---------- | ----------- |
185+
| `metallb.universe.tf/address-pool` | Select the address pool to allocate IP from |
186+
| `metallb.universe.tf/loadBalancerIPs` | Specify a specific IP address (supports multiple IPs, comma-separated) |
187+
188+
:::note
189+
- The specified IP must be within a configured MetalLB address pool
190+
- Make sure MetalLB is properly installed and configured before specifying VIPs
191+
- For MetalLB configuration, see [Configure MetalLB](../functions/configure_metallb.mdx#configure_ip_pool)
192+
:::
193+
154194
### How To Add Pod Annotations In Envoy Gateway
155195

156196
[Add pod annotation](./configure_endpoint_health_checker.mdx#add_pod_annotation_in_envoy_gateway)
@@ -363,8 +403,8 @@ For applications running inside the cluster, use the service ClusterIP instead o
363403
If you need to access the LoadBalancer VIP from any cluster node, change `externalTrafficPolicy` to `Cluster`:
364404

365405
```bash
366-
kubectl patch envoyproxy $GATEWAY_NAME -n $GATEWAY_NS --type='json' -p='[
367-
{"op": "replace", "path": "/spec/provider/kubernetes/envoyService/externalTrafficPolicy", "value": "Cluster"}
406+
kubectl patch envoyproxy $GATEWAY_NAME -n $GATEWAY_NS --type='json' -p='[
407+
{"op": "replace", "path": "/spec/provider/kubernetes/envoyService/externalTrafficPolicy", "value": "Cluster"}
368408
]'
369409
```
370410

0 commit comments

Comments
 (0)