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
Copy file name to clipboardExpand all lines: content/ngf/how-to/data-plane-configuration.md
+62-32Lines changed: 62 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -11,34 +11,34 @@ Learn how to dynamically update the NGINX Gateway Fabric global data plane confi
11
11
12
12
## Overview
13
13
14
-
NGINX Gateway Fabric can dynamically update the global data plane configuration without restarting. The data plane configuration contains configuration for NGINX that is not available using the standard Gateway API resources. This includes such things as setting an OpenTelemetry collector config, disabling http2, changing the IP family, or setting the NGINX error log level.
14
+
NGINX Gateway Fabric can dynamically update the global data plane configuration without restarting. The data plane configuration is a global configuration for NGINX that has options that is not available using the standard Gateway API resources. This includes options such as configuring an OpenTelemetry collector, disabling HTTP/2, changing the IP family, modifying infrastructure-related fields, and setting the NGINX error log level.
15
15
16
-
The data plane configuration is stored in the NginxProxy custom resource, which is a namespace-scoped resource that can be attached to a GatewayClass or Gateway. When attached to a GatewayClass, the fields in the NginxProxy affect all Gateways that belong to the GatewayClass.
17
-
When attached to a Gateway, the fields in the NginxProxy only affect the Gateway. If a GatewayClass and its Gateway both specify an NginxProxy, the GatewayClass NginxProxy provides defaults that can be overridden by the Gateway NginxProxy. See the [Merging Semantics](#merging-semantics) section for more detail.
16
+
The data plane configuration is stored in the `NginxProxy` custom resource, which is a namespace-scoped resource that can be attached to a gatewayClass or gateway. When attached to a gatewayClass, the fields in the NginxProxy affect all gateways that belong to the gatewayClass.
17
+
When attached to a gateway, the fields in the NginxProxy only affect the gateway. If a gatewayClass and its gateway both specify an NginxProxy, the gatewayClass NginxProxy provides defaults that can be overridden by the gateway NginxProxy. See the [Merging Semantics](#merging-semantics) section for more detail.
18
18
19
19
---
20
20
21
21
## Merging Semantics
22
22
23
-
NginxProxy resources are merged when a GatewayClass and a Gateway reference different NginxProxy resources.
23
+
NginxProxy resources are merged when a gatewayClass and a gateway reference different NginxProxy resources.
24
24
25
25
For fields that are bools, integers, and strings:
26
-
- If a field on the Gateway's NginxProxy is unspecified (`nil`), the Gateway__inherits__ the value of the field in the GatewayClass's NginxProxy.
27
-
- If a field on the Gateway's NginxProxy is specified, its value __overrides__ the value of the field in the GatewayClass's NginxProxy.
26
+
- If a field on the gateway's NginxProxy is unspecified (`nil`), the gateway__inherits__ the value of the field in the gatewayClass's NginxProxy.
27
+
- If a field on the gateway's NginxProxy is specified, its value __overrides__ the value of the field in the gatewayClass's NginxProxy.
28
28
29
29
For array fields:
30
-
- If the array on the Gateway's NginxProxy is unspecified (`nil`), the Gateway__inherits__ the entire array in the GatewayClass's NginxProxy.
31
-
- If the array on the Gateway's NginxProxy is empty, it __overrides__ the entire array in the GatewayClass's NginxProxy, effectively unsetting the field.
32
-
- If the array on the Gateway's NginxProxy is specified and not empty, it __overrides__ the entire array in the GatewayClass's NginxProxy.
30
+
- If the array on the gateway's NginxProxy is unspecified (`nil`), the gateway__inherits__ the entire array in the gatewayClass's NginxProxy.
31
+
- If the array on the gateway's NginxProxy is empty, it __overrides__ the entire array in the gatewayClass's NginxProxy, effectively unsetting the field.
32
+
- If the array on the gateway's NginxProxy is specified and not empty, it __overrides__ the entire array in the gatewayClass's NginxProxy.
33
33
34
34
35
35
### Merging Examples
36
36
37
-
This section contains examples of how NginxProxy resources are merged when they are attached to both a Gateway and its GatewayClass.
37
+
This section contains examples of how NginxProxy resources are merged when they are attached to both a gateway and its gatewayClass.
38
38
39
39
#### Disable HTTP/2 for a Gateway
40
40
41
-
A GatewayClass references the following NginxProxy which explicitly allows HTTP/2 traffic and sets the IPFamily to ipv4:
41
+
A gatewayClass references the following NginxProxy which explicitly allows HTTP/2 traffic and sets the IPFamily to ipv4:
42
42
43
43
```yaml
44
44
apiVersion: gateway.nginx.org/v1alpha2
@@ -51,7 +51,7 @@ spec:
51
51
disableHTTP: false
52
52
```
53
53
54
-
To disable HTTP/2 traffic for a particular Gateway, reference the following NginxProxy in the Gateway's spec:
54
+
To disable HTTP/2 traffic for a particular gateway, reference the following NginxProxy in the gateway's spec:
55
55
56
56
```yaml
57
57
apiVersion: gateway.nginx.org/v1alpha2
@@ -63,7 +63,7 @@ spec:
63
63
disableHTTP: true
64
64
```
65
65
66
-
These NginxProxy resources are merged and the following settings are applied to the Gateway:
66
+
These NginxProxy resources are merged and the following settings are applied to the gateway:
67
67
68
68
```yaml
69
69
ipFamily: "ipv4"
@@ -72,7 +72,7 @@ disableHTTP: true
72
72
73
73
#### Change Telemetry configuration for a Gateway
74
74
75
-
A GatewayClass references the following NginxProxy which configures telemetry:
75
+
A gatewayClass references the following NginxProxy which configures telemetry:
76
76
77
77
```yaml
78
78
apiVersion: gateway.nginx.org/v1alpha2
@@ -92,7 +92,7 @@ spec:
92
92
value: "company-value"
93
93
```
94
94
95
-
To change the telemetry configuration for a particular Gateway, reference the following NginxProxy in the Gateway's spec:
95
+
To change the telemetry configuration for a particular gateway, reference the following NginxProxy in the gateway's spec:
96
96
97
97
```yaml
98
98
apiVersion: gateway.nginx.org/v1alpha2
@@ -111,7 +111,7 @@ spec:
111
111
value: "app-value"
112
112
```
113
113
114
-
These NginxProxy resources are merged and the following settings are applied to the Gateway:
114
+
These NginxProxy resources are merged and the following settings are applied to the gateway:
115
115
116
116
```yaml
117
117
telemetry:
@@ -128,7 +128,7 @@ These NginxProxy resources are merged and the following settings are applied to
128
128
129
129
#### Disable Tracing for a Gateway
130
130
131
-
A GatewayClass references the following NginxProxy which configures telemetry:
131
+
A gatewayClass references the following NginxProxy which configures telemetry:
132
132
133
133
```yaml
134
134
apiVersion: gateway.nginx.org/v1alpha2
@@ -144,7 +144,7 @@ spec:
144
144
serviceName: "my-company"
145
145
```
146
146
147
-
To disable tracing for a particular Gateway, reference the following NginxProxy in the Gateway's spec:
147
+
To disable tracing for a particular gateway, reference the following NginxProxy in the gateway's spec:
148
148
149
149
```yaml
150
150
apiVersion: gateway.nginx.org/v1alpha2
@@ -158,7 +158,7 @@ spec:
158
158
- DisableTracing
159
159
```
160
160
161
-
These NginxProxy resources are merged and the following settings are applied to the Gateway:
161
+
These NginxProxy resources are merged and the following settings are applied to the gateway:
162
162
163
163
```yaml
164
164
telemetry:
@@ -172,9 +172,9 @@ telemetry:
172
172
173
173
---
174
174
175
-
## Configuring the GatewayClass NginxProxy on Install
175
+
## Configuring the GatewayClass NginxProxy on install
176
176
177
-
By default, the NginxProxy resource is not created when installing NGINX Gateway Fabric. However, you can set configuration options in the `nginx.config` Helm values, and the resource will be created and attached to the GatewayClass when NGINX Gateway Fabric is installed using Helm. You can also [manually create and attach](#manually-creating-nginxproxies) the resource after NGINX Gateway Fabric is already installed.
177
+
By default, the `NginxProxy` resource is created in the same namespace where NGINX Gateway Fabric is installed. You can set configuration options in the `nginx.` Helm values, and the resource will be created and attached using the set values, when NGINX Gateway Fabric is installed using Helm. You can also manually create and attach specific `NginxProxy` resources to target different data planes [manually creating NginxProxies](#manually-creating-nginxProxies).
178
178
179
179
When installed using the Helm chart, the NginxProxy resource is named `<release-name>-proxy-config` and is created in the release Namespace.
180
180
@@ -186,7 +186,7 @@ When installed using the Helm chart, the NginxProxy resource is named `<release-
186
186
187
187
## Manually Creating NginxProxies
188
188
189
-
The following command creates a basic `NginxProxy` configuration that sets the IP family to `ipv4` instead of the default value of `dual`:
189
+
The following command creates a basic `NginxProxy` configuration in the `default` namespace that sets the IP family to `ipv4` instead of the default value of `dual`:
190
190
191
191
```yaml
192
192
kubectl apply -f - <<EOF
@@ -200,13 +200,11 @@ spec:
200
200
EOF
201
201
```
202
202
203
-
**For a full list of configuration options that can be set, see the `NginxProxy spec` in the [API reference]({{< ref "/ngf/reference/api.md" >}}).**
204
-
205
203
---
206
204
207
205
### Attaching NginxProxy to GatewayClass
208
206
209
-
To attach the `ngf-proxy-config` NginxProxy to the GatewayClass:
207
+
To attach the `ngf-proxy-config` NginxProxy to the gatewayClass:
210
208
211
209
```shell
212
210
kubectl edit gatewayclass nginx
@@ -222,7 +220,7 @@ parametersRef:
222
220
namespace: default
223
221
```
224
222
225
-
After updating, you can check the status of the GatewayClass to see if the configuration is valid:
223
+
After updating, you can check the status of the gatewayClass to see if the configuration is valid:
226
224
227
225
```shell
228
226
kubectl describe gatewayclass nginx
@@ -246,7 +244,7 @@ If everything is valid, the `ResolvedRefs` condition should be `True`. Otherwise
246
244
247
245
### Attaching NginxProxy to Gateway
248
246
249
-
To attach the `ngf-proxy-config` NginxProxy to a Gateway:
247
+
To attach the `ngf-proxy-config` NginxProxy to a gateway:
250
248
251
249
```shell
252
250
kubectl edit gateway <gateway-name>
@@ -262,7 +260,7 @@ infrastructure:
262
260
name: ngf-proxy-config
263
261
```
264
262
265
-
After updating, you can check the status of the Gateway to see if the configuration is valid:
263
+
After updating, you can check the status of the gateway to see if the configuration is valid:
266
264
267
265
```shell
268
266
kubectl describe gateway <gateway-name>
@@ -282,11 +280,13 @@ Status:
282
280
283
281
If everything is valid, the `ResolvedRefs` condition should be `True`. Otherwise, you will see an `InvalidParameters` condition in the status.
284
282
283
+
{{< note >}} The `NginxProxy` resource must reside in the same namespace as the gateway it is attached to. {{< /note >}}
284
+
285
285
---
286
286
287
287
## Configure the data plane log level
288
288
289
-
You can use the `NginxProxy` resource to dynamically configure the Data Plane Log Level.
289
+
You can use the `NginxProxy` resource at the gatewayClass level to dynamically configure the log level for all data plane instances.
290
290
291
291
The following command creates a basic `NginxProxy` configuration that sets the log level to `warn` instead of the default value of `info`:
292
292
@@ -302,7 +302,7 @@ spec:
302
302
EOF
303
303
```
304
304
305
-
To view the full list of supported log levels, see the `NginxProxy spec` in the [API reference]({{< ref "/ngf/reference/api.md" >}}).
305
+
Other log levels supported are - debug, notice, error, crit, alert, emerg.
306
306
307
307
{{< note >}}For `debug` logging to work, NGINX needs to be built with `--with-debug` or "in debug mode". NGINX Gateway Fabric can easily
308
308
be [run with NGINX in debug mode](#run-nginx-gateway-fabric-with-nginx-in-debug-mode) upon startup through the addition
@@ -375,6 +375,36 @@ spec:
375
375
EOF
376
376
```
377
377
378
-
For the full configuration API, see the `NginxProxy spec` in the [API reference]({{< ref "/ngf/reference/api.md" >}}).
379
-
380
378
{{< note >}} When sending curl requests to a server expecting proxy information, use the flag `--haproxy-protocol` to avoid broken header errors. {{< /note >}}
379
+
380
+
---
381
+
382
+
## Configure infrastructure-related settings
383
+
384
+
You can configure deployment and service settings for all data plane instances by editing the `NginxProxy` resource at the gatewayClass level. These settings can also be specified under `nginx.` in the Helm values file.
385
+
386
+
Users can specify these settings for NGINX data plane deployments:
387
+
388
+
- _replicas_ specifies the number of data plane pod replicas..
389
+
- The `pod` section provides control over pod scheduling and lifecycle behavior. You can configure settings such as _terminationGracePeriodSeconds_, _tolerations_, _nodeSelector_, _affinity_, and _topologySpreadConstraints_. Use _extraVolumes_ to mount additional volumes, typically alongside container-level _extraVolumeMounts_.
390
+
- The `container` defines settings for the NGINX container itself., such as resource requests and limits using _resources_, and lifecycle hooks like preStop or postStart via _lifecycle_. You can also specify _extraVolumeMounts_ to mount additional volumes defined at the pod level.
391
+
392
+
Users can specify these settings for NGINX data plane service in the `service` config:
393
+
394
+
- _type_ specifies the service type for the NGINX data plane. Allowed values are ClusterIP, NodePort, or LoadBalancer.
395
+
- _externalTrafficPolicy_ sets how external traffic is handled. `Local` preserves the client’s source IP.
396
+
- _annotations_ adds custom annotations to the NGINX data plane service.
397
+
- Certain fields are only applicable when _service.type_ is set to `LoadBalancer`: _loadBalancerIP_ to assign a static IP, _loadBalancerClass_ to define the load balancer implementation, and _loadBalancerSourceRanges_ to restrict access to specific IP ranges (CIDRs).
398
+
399
+
The below fields can only be specified when the `service.type` is `LoadBalancer`:
400
+
- _loadBalancerIP_ specifies the static IP address of the load balancer.
401
+
- _loadBalancerClass_ specifies the class of the load balancer implementation this service belongs to.
402
+
- _loadBalancerSourceRanges_ specifies IP ranges (CIDR) that are allowed to access the load balancer.
403
+
404
+
---
405
+
406
+
## See also
407
+
408
+
For a full list of configuration options that can be set, see the `NginxProxy spec` in the [API reference]({{< ref "/ngf/reference/api.md" >}}).
0 commit comments