Skip to content

Commit 72ad28e

Browse files
authored
NGF: Update data plane configuration doc (#529)
docs: Updata data plane configuration doc to reflect changes to NginxProxy resource
1 parent 27babac commit 72ad28e

File tree

1 file changed

+47
-51
lines changed

1 file changed

+47
-51
lines changed

content/ngf/how-to/data-plane-configuration.md

+47-51
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Learn how to dynamically update the NGINX Gateway Fabric global data plane confi
1111

1212
## Overview
1313

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 contains configuration for NGINX 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.
1515

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.
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.
1717
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.
1818

1919
---
@@ -172,21 +172,19 @@ telemetry:
172172
173173
---
174174
175-
## Configuring the GatewayClass NginxProxy on Install
175+
## Configuring the GatewayClass NginxProxy on install
176176
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, an `NginxProxy` resource is created in the same namespace where NGINX Gateway Fabric is installed, attached to the GatewayClass. You can set configuration options in the `nginx` Helm value section, and the resource will be created and attached using the set values. You can also [manually create and attach](#manually-creating-nginxProxies) specific `NginxProxy` resources to target different Gateways.
178178

179179
When installed using the Helm chart, the NginxProxy resource is named `<release-name>-proxy-config` and is created in the release Namespace.
180180

181-
**For a full list of configuration options that can be set, see the `NginxProxy spec` in the [API reference]({{< ref "/ngf/reference/api.md" >}}).**
182-
183181
{{< note >}} Some global configuration also requires an [associated policy]({{< ref "/ngf/overview/custom-policies.md" >}}) to fully enable a feature (such as [tracing]({{< ref "/ngf/how-to/monitoring/tracing.md" >}}), for example). {{< /note >}}
184182

185183
---
186184

187185
## Manually Creating NginxProxies
188186

189-
The following command creates a basic `NginxProxy` configuration that sets the IP family to `ipv4` instead of the default value of `dual`:
187+
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`:
190188

191189
```yaml
192190
kubectl apply -f - <<EOF
@@ -200,47 +198,7 @@ spec:
200198
EOF
201199
```
202200

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-
---
206-
207-
### Attaching NginxProxy to GatewayClass
208-
209-
To attach the `ngf-proxy-config` NginxProxy to the GatewayClass:
210-
211-
```shell
212-
kubectl edit gatewayclass nginx
213-
```
214-
215-
This will open your default editor, allowing you to add the following to the `spec`:
216-
217-
```yaml
218-
parametersRef:
219-
group: gateway.nginx.org
220-
kind: NginxProxy
221-
name: ngf-proxy-config
222-
namespace: default
223-
```
224-
225-
After updating, you can check the status of the GatewayClass to see if the configuration is valid:
226-
227-
```shell
228-
kubectl describe gatewayclass nginx
229-
```
230-
231-
```text
232-
...
233-
Status:
234-
Conditions:
235-
...
236-
Message: parametersRef resource is resolved
237-
Observed Generation: 1
238-
Reason: ResolvedRefs
239-
Status: True
240-
Type: ResolvedRefs
241-
```
242-
243-
If everything is valid, the `ResolvedRefs` condition should be `True`. Otherwise, you will see an `InvalidParameters` condition in the status.
201+
For a full list of configuration options that can be set, see the `NginxProxy spec` in the [API reference]({{< ref "/ngf/reference/api.md" >}}).
244202

245203
---
246204

@@ -262,6 +220,8 @@ infrastructure:
262220
name: ngf-proxy-config
263221
```
264222

223+
{{< note >}} The `NginxProxy` resource must reside in the same namespace as the Gateway it is attached to. {{< /note >}}
224+
265225
After updating, you can check the status of the Gateway to see if the configuration is valid:
266226

267227
```shell
@@ -286,7 +246,7 @@ If everything is valid, the `ResolvedRefs` condition should be `True`. Otherwise
286246

287247
## Configure the data plane log level
288248

289-
You can use the `NginxProxy` resource to dynamically configure the Data Plane Log Level.
249+
You can use the `NginxProxy` resource to dynamically configure the log level.
290250

291251
The following command creates a basic `NginxProxy` configuration that sets the log level to `warn` instead of the default value of `info`:
292252

@@ -375,6 +335,42 @@ spec:
375335
EOF
376336
```
377337

378-
For the full configuration API, see the `NginxProxy spec` in the [API reference]({{< ref "/ngf/reference/api.md" >}}).
379-
380338
{{< note >}} When sending curl requests to a server expecting proxy information, use the flag `--haproxy-protocol` to avoid broken header errors. {{< /note >}}
339+
340+
---
341+
342+
## Configure infrastructure-related settings
343+
344+
You can configure deployment and service settings for all data plane instances by editing the `NginxProxy` resource at the Gateway or GatewayClass level. These settings can also be specified under the `nginx` section in the Helm values file. You can edit things such as replicas, pod scheduling options, container resource limits, extra volume mounts, service types and load balancer settings.
345+
346+
The following command creates an `NginxProxy` resource with 2 replicas, sets `container.resources.requests` to 100m CPU and 128Mi memory, configures a 90 second `pod.terminationGracePeriodSeconds`, and sets the service type to `LoadBalancer` with IP `192.87.9.1` and AWS NLB annotation.
347+
348+
```yaml
349+
kubectl apply -f - <<EOF
350+
apiVersion: gateway.nginx.org/v1alpha2
351+
kind: NginxProxy
352+
metadata:
353+
name: ngf-proxy-config-test
354+
spec:
355+
kubernetes:
356+
deployment:
357+
container:
358+
resources:
359+
requests:
360+
cpu: 100m
361+
memory: 128Mi
362+
pod:
363+
terminationGracePeriodSeconds: 90
364+
replicas: 2
365+
service:
366+
annotations:
367+
service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
368+
type: LoadBalancer
369+
loadBalancerIP: "192.87.9.1"
370+
EOF
371+
```
372+
373+
To view the full list of configuration options, see the `NginxProxy spec` in the [API reference]({{< ref "/ngf/reference/api.md" >}}).
374+
375+
---
376+

0 commit comments

Comments
 (0)