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
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.
Copy file name to clipboardExpand all lines: content/ngf/how-to/monitoring/dashboard.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -17,10 +17,10 @@ The NGINX Plus dashboard offers a real-time live activity monitoring interface t
17
17
18
18
To access the dashboard:
19
19
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).
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
-
180
173
You can now create the application, route, and tracing policy.
181
174
182
175
---
@@ -257,6 +250,15 @@ spec:
257
250
EOF
258
251
```
259
252
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
+
260
262
Check that traffic can flow to the application.
261
263
262
264
{{< 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 >}}
Copy file name to clipboardExpand all lines: content/ngf/how-to/monitoring/troubleshooting.md
+86-36
Original file line number
Diff line number
Diff line change
@@ -80,7 +80,7 @@ LAST SEEN TYPE REASON OBJECT
80
80
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`:
@@ -118,13 +118,13 @@ You can see logs for a crashed or killed container by adding the `-p` flag to th
118
118
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:
2024/06/13 20:04:17 [emerg] 27#27: too long parameter, probably missing terminating """ character in /etc/nginx/conf.d/http.conf:78
129
129
```
130
130
@@ -158,7 +158,7 @@ server {
158
158
}
159
159
```
160
160
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:
162
162
163
163
1. A Gateway with single listener with the hostname `*.example.com` on port 80.
164
164
2. A simple `coffee` application.
@@ -290,10 +290,6 @@ The configuration may change in future releases. This configuration is valid for
290
290
291
291
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.
292
292
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
-
297
293
---
298
294
299
295
#### Access the NGINX Plus Dashboard
@@ -336,46 +332,100 @@ To understand why the NGINX Gateway Fabric Pod has not started running or is not
336
332
kubectl describe pod <ngf-pod-name> -n nginx-gateway
337
333
```
338
334
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.
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-5dg45 (ro)
369
+
/var/run/secrets/ngf from nginx-agent-tls (rw)
369
370
Events:
370
371
Type Reason Age From Message
371
372
---- ------ ---- ---- -------
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.
- 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 >}}
37
29
38
30
---
39
31
@@ -69,6 +61,16 @@ EOF
69
61
```
70
62
71
63
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 >}}
72
74
73
75
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:
74
76
@@ -154,7 +156,7 @@ This HTTPRoute has a few important properties:
154
156
155
157
### Send traffic to Coffee
156
158
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.
158
160
159
161
{{< 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 >}}
160
162
@@ -269,7 +271,7 @@ The properties of this HTTPRoute include:
269
271
270
272
### Send traffic to Tea
271
273
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.
273
275
274
276
{{< 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 >}}
275
277
@@ -303,7 +305,7 @@ This request should receive a response from the `tea-post` pod. Any other type o
303
305
304
306
If you have any issues while sending traffic, try the following to debug your configuration and setup:
305
307
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.
- 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 >}}
50
42
51
43
- Create the coffee and tea example applications:
52
44
@@ -59,16 +51,27 @@ For all the possible configuration options for `ClientSettingsPolicy`, see the [
- 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
+
69
72
- Test the configuration:
70
73
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.
- 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 >}}
38
23
39
24
---
40
25
@@ -175,6 +160,18 @@ This gateway configures:
175
160
-`http` listener for HTTP traffic
176
161
-`https` listener for HTTPS traffic. It terminates TLS connections using the `cafe-secret` we created.
177
162
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
+
178
175
To create the httproute resources, copy and paste the following into your terminal:
179
176
180
177
```yaml
@@ -223,7 +220,7 @@ The first route issues a `requestRedirect` from the `http` listener on port 80 t
223
220
224
221
## Send traffic
225
222
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.
227
224
228
225
{{< 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 >}}
0 commit comments