Skip to content

Commit 59dbd52

Browse files
authored
NGF: Update documentation on accessing nginx container (#453)
Update documentation on accessing nginx container Problem: With our incoming changes to our control data plane split, the nginx container will no longer be in the NGF Pod. Thus all documentation on accessing the nginx container (logs, sending traffic, config...) need to be updated. Solution: Updated the documentation. Mainly, when sending traffic in the examples, the host and IP of the NGINX Service are recorded after the Gateway is deployed. Also updated a link in the NGINX Plus feature document to point away from the NGINX Prometheus exporter and to the internal document showing metrics.
1 parent e95d5f2 commit 59dbd52

17 files changed

+260
-178
lines changed

content/ngf/how-to/monitoring/dashboard.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ The NGINX Plus dashboard offers a real-time live activity monitoring interface t
1717

1818
To access the dashboard:
1919

20-
1. Use port-forwarding to forward connections to port 8765 on your local machine to port 8765 on the NGINX Gateway Fabric pod (replace `<nginx-gateway-fabric-pod>` with the actual name of the pod).
20+
1. Use port-forwarding to forward connections to port 8765 on your local machine to port 8765 on the NGINX Plus pod (replace `<nginx-plus-pod>` with the actual name of the pod).
2121

2222
```shell
23-
kubectl port-forward <nginx-gateway-fabric-pod> 8765:8765 -n nginx-gateway
23+
kubectl port-forward <nginx-plus-pod> 8765:8765 -n <nginx-plus-pod-namespace>
2424
```
2525

2626
1. Open your browser to [http://127.0.0.1:8765/dashboard.html](http://127.0.0.1:8765/dashboard.html) to access the dashboard.

content/ngf/how-to/monitoring/tracing.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,6 @@ If you already have NGINX Gateway Fabric installed, then you can create the `Ngi
170170
kubectl edit gatewayclasses.gateway.networking.k8s.io nginx
171171
```
172172

173-
Save the public IP address and port of NGINX Gateway Fabric into shell variables:
174-
175-
```text
176-
GW_IP=XXX.YYY.ZZZ.III
177-
GW_PORT=<port number>
178-
```
179-
180173
You can now create the application, route, and tracing policy.
181174

182175
---
@@ -257,6 +250,15 @@ spec:
257250
EOF
258251
```
259252

253+
After creating the Gateway resource, NGINX Gateway Fabric will provision an NGINX Pod and Service fronting it to route traffic.
254+
255+
Save the public IP address and port of the NGINX Service into shell variables:
256+
257+
```text
258+
GW_IP=XXX.YYY.ZZZ.III
259+
GW_PORT=<port number>
260+
```
261+
260262
Check that traffic can flow to the application.
261263

262264
{{< note >}} If you have a DNS record allocated for `cafe.example.com`, you can send the request directly to that hostname, without needing to resolve. {{< /note >}}

content/ngf/how-to/monitoring/troubleshooting.md

+86-36
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ LAST SEEN TYPE REASON OBJECT
8080
Getting shell access to containers allows developers and operators to view the environment of a running container, see its logs or diagnose any problems. To get shell access to the NGINX container, use `kubectl exec`:
8181

8282
```shell
83-
kubectl exec -it -n nginx-gateway <ngf-pod-name> -c nginx -- /bin/sh
83+
kubectl exec -it -n <nginx-pod-namespace> <nginx-pod-name> -- /bin/sh
8484
```
8585

8686
---
@@ -104,7 +104,7 @@ You can see logs for a crashed or killed container by adding the `-p` flag to th
104104
To see logs for the data plane container:
105105

106106
```shell
107-
kubectl -n nginx-gateway logs <ngf-pod-name> -c nginx
107+
kubectl -n <nginx-pod-namespace> logs <nginx-pod-name> -c nginx
108108
```
109109

110110
1. Error Logs
@@ -118,13 +118,13 @@ You can see logs for a crashed or killed container by adding the `-p` flag to th
118118
For the _nginx_ container you can `grep` for various [error](https://nginx.org/en/docs/ngx_core_module.html#error_log) logs. For example, to search for all logs logged at the `emerg` level:
119119

120120
```shell
121-
kubectl -n nginx-gateway logs <ngf-pod-name> -c nginx | grep emerg
121+
kubectl -n <nginx-pod-namespace> logs <nginx-pod-name> -c nginx | grep emerg
122122
```
123123

124124
For example, if a variable is too long, NGINX may display such an error message:
125125

126126
```text
127-
kubectl logs -n nginx-gateway ngf-nginx-gateway-fabric-bb8598998-jwk2m -c nginx | grep emerg
127+
kubectl logs -n dev-env gateway-nginx-bb8598998-jwk2m -c nginx | grep emerg
128128
2024/06/13 20:04:17 [emerg] 27#27: too long parameter, probably missing terminating """ character in /etc/nginx/conf.d/http.conf:78
129129
```
130130

@@ -158,7 +158,7 @@ server {
158158
}
159159
```
160160

161-
Once a HTTPRoute with path matches and rules are defined, nginx.conf is updated accordingly to determine which location block will manage incoming requests. To demonstrate how `nginx.conf` is changed, create some resources:
161+
Once an HTTPRoute with path matches and rules are defined, nginx.conf is updated accordingly to determine which location block will manage incoming requests. To demonstrate how `nginx.conf` is changed, create some resources:
162162

163163
1. A Gateway with single listener with the hostname `*.example.com` on port 80.
164164
2. A simple `coffee` application.
@@ -290,10 +290,6 @@ The configuration may change in future releases. This configuration is valid for
290290

291291
Metrics can be useful to identify performance bottlenecks and pinpoint areas of high resource consumption within NGINX Gateway Fabric. To set up metrics collection, refer to the [Prometheus Metrics guide]({{< ref "prometheus.md" >}}). The metrics dashboard will help you understand problems with the way NGINX Gateway Fabric is set up or potential issues that could show up with time.
292292

293-
For example, metrics `nginx_reloads_total` and `nginx_reload_errors_total` offer valuable insights into the system's stability and reliability. A high `nginx_reloads_total` value indicates frequent updates or configuration changes, while a high `nginx_reload_errors_total` value suggests issues with the configuration or other problems preventing successful reloads. Monitoring these metrics helps identify and resolve configuration errors, ensuring consistent service reliability.
294-
295-
In such situations, it's advisable to review the logs of both NGINX and NGINX Gateway containers for any potential error messages. Additionally, verify the configured resources to ensure they are in a valid state.
296-
297293
---
298294

299295
#### Access the NGINX Plus Dashboard
@@ -336,46 +332,100 @@ To understand why the NGINX Gateway Fabric Pod has not started running or is not
336332
kubectl describe pod <ngf-pod-name> -n nginx-gateway
337333
```
338334

339-
The Pod description includes details about the image name, tags, current status, and environment variables. Verify that these details match your setup and cross-check with the events to ensure everything is functioning as expected. For example, the Pod below has two containers that are running and the events reflect the same.
335+
The Pod description includes details about the image name, tags, current status, and environment variables. Verify that these details match your setup and cross-check with the events to ensure everything is functioning as expected. For example, the Pod below has the nginx-gateway container that is running and the events reflect the same.
340336

341337
```text
342338
Containers:
343339
nginx-gateway:
344-
Container ID: containerd://06c97a9de938b35049b7c63e251418395aef65dd1ff996119362212708b79cab
345-
Image: nginx-gateway-fabric
346-
Image ID: docker.io/library/import-2024-06-13@sha256:1460d63bd8a352a6e455884d7ebf51ce9c92c512cb43b13e44a1c3e3e6a08918
347-
Ports: 9113/TCP, 8081/TCP
348-
Host Ports: 0/TCP, 0/TCP
340+
Container ID: containerd://492f380d5919ae2cdca0e009e7a7d5bf4092f8e1910f52d8951d58b73f125646
341+
Image: nginx-gateway-fabric:latest
342+
Image ID: sha256:c034f1e5bde0490b1f2441e0e9b0bcfce5f2e259bb6210c55d4d67f808a74ecb
343+
Ports: 8443/TCP, 9113/TCP, 8081/TCP
344+
Host Ports: 0/TCP, 0/TCP, 0/TCP
345+
SeccompProfile: RuntimeDefault
346+
Args:
347+
controller
348+
--gateway-ctlr-name=gateway.nginx.org/nginx-gateway-controller
349+
--gatewayclass=nginx
350+
--config=my-release-config
351+
--service=my-release-nginx-gateway-fabric
352+
--agent-tls-secret=agent-tls
353+
--metrics-port=9113
354+
--health-port=8081
355+
--leader-election-lock-name=my-release-nginx-gateway-fabric-leader-election
349356
State: Running
350-
Started: Thu, 13 Jun 2024 11:47:46 -0600
357+
Started: Thu, 24 Apr 2025 10:57:16 -0700
351358
Ready: True
352359
Restart Count: 0
353360
Readiness: http-get http://:health/readyz delay=3s timeout=1s period=1s #success=1 #failure=3
354361
Environment:
355-
POD_IP: (v1:status.podIP)
356362
POD_NAMESPACE: nginx-gateway (v1:metadata.namespace)
357-
POD_NAME: ngf-nginx-gateway-fabric-66dd665756-zh7d7 (v1:metadata.name)
358-
nginx:
359-
Container ID: containerd://c2f3684fd8922e4fac7d5707ab4eb5f49b1f76a48893852c9a812cd6dbaa2f55
360-
Image: nginx-gateway-fabric/nginx
361-
Image ID: docker.io/library/import-2024-06-13@sha256:c9a02cb5665c6218373f8f65fc2c730f018d0ca652ae827cc913a7c6e9db6f45
362-
Ports: 80/TCP, 443/TCP
363-
Host Ports: 0/TCP, 0/TCP
364-
State: Running
365-
Started: Thu, 13 Jun 2024 11:47:46 -0600
366-
Ready: True
367-
Restart Count: 0
368-
Environment: <none>
363+
POD_NAME: my-release-nginx-gateway-fabric-b99bd5cdd-qzp5q (v1:metadata.name)
364+
POD_UID: (v1:metadata.uid)
365+
INSTANCE_NAME: (v1:metadata.labels['app.kubernetes.io/instance'])
366+
IMAGE_NAME: nginx-gateway-fabric:latest
367+
Mounts:
368+
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-5dg45 (ro)
369+
/var/run/secrets/ngf from nginx-agent-tls (rw)
369370
Events:
370371
Type Reason Age From Message
371372
---- ------ ---- ---- -------
372-
Normal Scheduled 40s default-scheduler Successfully assigned nginx-gateway/ngf-nginx-gateway-fabric-66dd665756-zh7d7 to kind-control-plane
373-
Normal Pulled 40s kubelet Container image "nginx-gateway-fabric" already present on machine
374-
Normal Created 40s kubelet Created container nginx-gateway
375-
Normal Started 39s kubelet Started container nginx-gateway
376-
Normal Pulled 39s kubelet Container image "nginx-gateway-fabric/nginx" already present on machine
377-
Normal Created 39s kubelet Created container nginx
378-
Normal Started 39s kubelet Started container nginx
373+
Normal Scheduled 22s default-scheduler Successfully assigned nginx-gateway/my-release-nginx-gateway-fabric-b99bd5cdd-qzp5q to kind-control-plane
374+
Normal Pulled 20s kubelet Container image "nginx-gateway-fabric:latest" already present on machine
375+
Normal Created 20s kubelet Created container: nginx-gateway
376+
Normal Started 20s kubelet Started container nginx-gateway
377+
```
378+
379+
---
380+
381+
##### NGINX Pod is not running or ready
382+
383+
To understand why the NGINX Pod has not started running or is not ready, check the state of the Pod to get detailed information about the current status and events happening in the Pod. To do this, use `kubectl describe`:
384+
385+
```shell
386+
kubectl describe pod <nginx-pod-name> -n <nginx-pod-namespace>
387+
```
388+
389+
The Pod description includes details about the image name, tags, current status, and environment variables. Verify that these details match your setup and cross-check with the events to ensure everything is functioning as expected. For example, the Pod below has the nginx container that is running and the events reflect the same.
390+
391+
```text
392+
Containers:
393+
nginx:
394+
Container ID: containerd://0dd33fd358ba3b369de315be15b197e369342aba7aa8d3ea12e4455823fa90ce
395+
Image: nginx-gateway-fabric/nginx:latest
396+
Image ID: sha256:e5cb19bab49cbde6222df607a0946e1e00c1af767263b79ae36e4c69f8547f20
397+
Ports: 80/TCP, 9113/TCP
398+
Host Ports: 0/TCP, 0/TCP
399+
SeccompProfile: RuntimeDefault
400+
State: Running
401+
Started: Thu, 24 Apr 2025 10:57:36 -0700
402+
Ready: True
403+
Restart Count: 0
404+
Environment: <none>
405+
Mounts:
406+
/etc/nginx-agent from nginx-agent (rw)
407+
/etc/nginx/conf.d from nginx-conf (rw)
408+
/etc/nginx/includes from nginx-includes (rw)
409+
/etc/nginx/main-includes from nginx-main-includes (rw)
410+
/etc/nginx/secrets from nginx-secrets (rw)
411+
/etc/nginx/stream-conf.d from nginx-stream-conf (rw)
412+
/var/cache/nginx from nginx-cache (rw)
413+
/var/lib/nginx-agent from nginx-agent-lib (rw)
414+
/var/log/nginx-agent from nginx-agent-log (rw)
415+
/var/run/nginx from nginx-run (rw)
416+
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-f9kph (ro)
417+
/var/run/secrets/ngf from nginx-agent-tls (rw)
418+
/var/run/secrets/ngf/serviceaccount from token (rw)
419+
Events:
420+
Type Reason Age From Message
421+
---- ------ ---- ---- -------
422+
Normal Scheduled 2m57s default-scheduler Successfully assigned default/gateway-nginx-85f7f6d7d-fx7q2 to kind-control-plane
423+
Normal Pulled 2m54s kubelet Container image "nginx-gateway-fabric:latest" already present on machine
424+
Normal Created 2m54s kubelet Created container: init
425+
Normal Started 2m54s kubelet Started container init
426+
Normal Pulled 2m53s kubelet Container image "nginx-gateway-fabric/nginx:latest" already present on machine
427+
Normal Created 2m53s kubelet Created container: nginx
428+
Normal Started 2m53s kubelet Started container nginx
379429
```
380430

381431
---

content/ngf/how-to/traffic-management/advanced-routing.md

+13-11
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@ The goal is to create a set of rules that will result in client requests being s
2626
## Before you begin
2727

2828
- [Install]({{< ref "/ngf/installation/" >}}) NGINX Gateway Fabric.
29-
- Save the public IP address and port of NGINX Gateway Fabric into shell variables:
30-
31-
```text
32-
GW_IP=XXX.YYY.ZZZ.III
33-
GW_PORT=<port number>
34-
```
35-
36-
{{< note >}} In a production environment, you should have a DNS record for the external IP address that is exposed, and it should refer to the hostname that the gateway will forward for. {{< /note >}}
3729

3830
---
3931

@@ -69,6 +61,16 @@ EOF
6961
```
7062

7163
This gateway defines a single listener on port 80. Since no hostname is specified, this listener matches on all hostnames.
64+
After creating the Gateway resource, NGINX Gateway Fabric will provision an NGINX Pod and Service fronting it to route traffic.
65+
66+
Save the public IP address and port of the NGINX Service into shell variables:
67+
68+
```text
69+
GW_IP=XXX.YYY.ZZZ.III
70+
GW_PORT=<port number>
71+
```
72+
73+
{{< note >}}In a production environment, you should have a DNS record for the external IP address that is exposed, and it should refer to the hostname that the gateway will forward for.{{< /note >}}
7274

7375
The [HTTPRoute](https://gateway-api.sigs.k8s.io/api-types/httproute/) is typically deployed by the [application developer](https://gateway-api.sigs.k8s.io/concepts/roles-and-personas/#roles-and-personas_1). To deploy the `coffee` HTTPRoute:
7476

@@ -154,7 +156,7 @@ This HTTPRoute has a few important properties:
154156

155157
### Send traffic to Coffee
156158

157-
Using the external IP address and port for NGINX Gateway Fabric, we can send traffic to our coffee applications.
159+
Using the external IP address and port for the NGINX Service, we can send traffic to our coffee applications.
158160

159161
{{< note >}} If you have a DNS record allocated for `cafe.example.com`, you can send the request directly to that hostname, without needing to resolve. {{< /note >}}
160162

@@ -269,7 +271,7 @@ The properties of this HTTPRoute include:
269271

270272
### Send traffic to Tea
271273

272-
Using the external IP address and port for NGINX Gateway Fabric, we can send traffic to our tea applications.
274+
Using the external IP address and port for the NGINX Service, we can send traffic to our tea applications.
273275

274276
{{< note >}} If you have a DNS record allocated for `cafe.example.com`, you can send the request directly to that hostname, without needing to resolve. {{< /note >}}
275277

@@ -303,7 +305,7 @@ This request should receive a response from the `tea-post` pod. Any other type o
303305

304306
If you have any issues while sending traffic, try the following to debug your configuration and setup:
305307

306-
- Make sure you set the shell variables $GW_IP and $GW_PORT to the public IP and port of the NGINX Gateway Fabric service. Refer to the [Installation]({{< ref "/ngf/installation/" >}}) guides for more information.
308+
- Make sure you set the shell variables $GW_IP and $GW_PORT to the public IP and port of the NGINX Service. Refer to the [Installation]({{< ref "/ngf/installation/" >}}) guides for more information.
307309

308310
- Check the status of the Gateway:
309311

content/ngf/how-to/traffic-management/client-settings.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ For all the possible configuration options for `ClientSettingsPolicy`, see the [
3939
## Before you begin
4040

4141
- [Install]({{< ref "/ngf/installation/" >}}) NGINX Gateway Fabric.
42-
- Save the public IP address and port of NGINX Gateway Fabric into shell variables:
43-
44-
```text
45-
GW_IP=XXX.YYY.ZZZ.III
46-
GW_PORT=<port number>
47-
```
48-
49-
{{< note >}}In a production environment, you should have a DNS record for the external IP address that is exposed, and it should refer to the hostname that the gateway will forward for.{{< /note >}}
5042

5143
- Create the coffee and tea example applications:
5244

@@ -59,16 +51,27 @@ For all the possible configuration options for `ClientSettingsPolicy`, see the [
5951
```yaml
6052
kubectl apply -f https://raw.githubusercontent.com/nginx/nginx-gateway-fabric/v{{< version-ngf >}}/examples/client-settings-policy/gateway.yaml
6153
```
54+
After creating the Gateway resource, NGINX Gateway Fabric will provision an NGINX Pod and Service fronting it to route traffic.
6255

6356
- Create HTTPRoutes for the coffee and tea applications:
6457

6558
```yaml
6659
kubectl apply -f https://raw.githubusercontent.com/nginx/nginx-gateway-fabric/v{{< version-ngf >}}/examples/client-settings-policy/httproutes.yaml
6760
```
6861

62+
- Save the public IP address and port of the NGINX Service into shell variables:
63+
64+
```text
65+
GW_IP=XXX.YYY.ZZZ.III
66+
GW_PORT=<port number>
67+
```
68+
69+
{{< note >}}In a production environment, you should have a DNS record for the external IP address that is exposed, and it should refer to the hostname that the gateway will forward for.{{< /note >}}
70+
71+
6972
- Test the configuration:
7073

71-
You can send traffic to the coffee and tea applications using the external IP address and port for NGINX Gateway Fabric.
74+
You can send traffic to the coffee and tea applications using the external IP address and port for the NGINX Service.
7275

7376
Send a request to coffee:
7477

content/ngf/how-to/traffic-management/https-termination.md

+13-16
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,6 @@ In this guide, we will show how to configure HTTPS termination for your applicat
2020
## Before you begin
2121

2222
- [Install]({{< ref "/ngf/installation/" >}}) NGINX Gateway Fabric.
23-
- Save the public IP address and port of NGINX Gateway Fabric into shell variables:
24-
25-
```text
26-
GW_IP=XXX.YYY.ZZZ.III
27-
GW_PORT=<port number>
28-
```
29-
30-
Save the ports of NGINX Gateway Fabric:
31-
32-
```text
33-
GW_HTTP_PORT=<http port number>
34-
GW_HTTPS_PORT=<https port number>
35-
```
36-
37-
{{< note >}}In a production environment, you should have a DNS record for the external IP address that is exposed, and it should refer to the hostname that the gateway will forward for.{{< /note >}}
3823

3924
---
4025

@@ -175,6 +160,18 @@ This gateway configures:
175160
- `http` listener for HTTP traffic
176161
- `https` listener for HTTPS traffic. It terminates TLS connections using the `cafe-secret` we created.
177162

163+
After creating the Gateway resource, NGINX Gateway Fabric will provision an NGINX Pod and Service fronting it to route traffic.
164+
165+
Save the public IP address and ports of the NGINX Service into shell variables:
166+
167+
```text
168+
GW_IP=XXX.YYY.ZZZ.III
169+
GW_HTTP_PORT=<http port number>
170+
GW_HTTPS_PORT=<https port number>
171+
```
172+
173+
{{< note >}}In a production environment, you should have a DNS record for the external IP address that is exposed, and it should refer to the hostname that the gateway will forward for.{{< /note >}}
174+
178175
To create the httproute resources, copy and paste the following into your terminal:
179176

180177
```yaml
@@ -223,7 +220,7 @@ The first route issues a `requestRedirect` from the `http` listener on port 80 t
223220

224221
## Send traffic
225222

226-
Using the external IP address and port for NGINX Gateway Fabric, we can send traffic to our coffee application.
223+
Using the external IP address and ports for the NGINX Service, we can send traffic to our coffee application.
227224

228225
{{< note >}}If you have a DNS record allocated for `cafe.example.com`, you can send the request directly to that hostname, without needing to resolve.{{< /note >}}
229226

0 commit comments

Comments
 (0)