Skip to content

Commit 237a7cd

Browse files
committed
Add troubleshooting doc
1 parent 5a71305 commit 237a7cd

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

docs/troubleshooting.md

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Troubleshooting the Ingress Controller
2+
3+
This document describes how to troubleshoot problems with the Ingress Controller.
4+
5+
## Potential Problems
6+
7+
The table below categories some potential problems with the Ingress Controller you may encounter and suggests how to troubleshoot those problems using one or more methods from the next section.
8+
9+
| Problem area | Symptom | Troubleshooting method | Common cause |
10+
| ------------ | ----------- | ------- | -------------- |
11+
| Start | The Ingress Controller fails to start. | Check the logs. | Misconfigured RBAC, a missing default server TLS Secret. |
12+
| Ingress Resource and Annotations | The configuration is not applied. | Check the events of the Ingress resource, check the logs, check the generated config. | Invalid values of annotations. |
13+
ConfigMap Keys | The configuration is not applied. | Check the events of the ConfigMap, check the logs, check the generated config. | Invalid values of ConfigMap keys. |
14+
| NGINX | NGINX responds with unexpected responses. | Check the logs, check the generated config, check the live activity dashboard (NGINX Plus only), run NGINX in the debug mode. | Unhealthy backend pods, a misconfigured backend service. |
15+
16+
17+
## Troubleshooting Methods
18+
19+
Note that the commands in the next sections make the following assumptions:
20+
* The Ingress Controller is deployed in the namespace `nginx-ingress`.
21+
* `<nginx-ingress-pod>` is the name of one of the Ingress Controller pods.
22+
23+
### Checking the Ingress Controller Logs
24+
25+
To check the Ingress Controller logs -- both of the Ingress Controller software and the NGINX access and error logs -- run:
26+
```
27+
$ kubectl logs <nginx-ingress-pod> -n nginx-ingress
28+
```
29+
30+
Controlling the verbosity and format:
31+
* To control the verbosity of the Ingress Controller software logs (from 1 to 4), use the `-v` [command-line argument](cli-arguments.md). For example, with `-v=3` you will get more information and the content of any new or updated configuration file will be printed in the logs.
32+
* To control the verbosity and the format of the NGINX logs, configure the corresponding [ConfigMap keys](configmap-and-annotations.md).
33+
34+
### Checking the Events of an Ingress Resource
35+
36+
After you create or update an Ingress resource, you can immediately check if the NGINX configuration for that Ingress resource was successfully applied by NGINX:
37+
```
38+
$ kubectl describe ing cafe-ingress
39+
Name: cafe-ingress
40+
Namespace: default
41+
. . .
42+
Events:
43+
Type Reason Age From Message
44+
---- ------ ---- ---- -------
45+
Normal AddedOrUpdated 12s nginx-ingress-controller Configuration for default/cafe-ingress was added or updated
46+
```
47+
Note how in the events section we have a Normal event with the AddedOrUpdated reason informing us that the configuration was successfully applied.
48+
49+
### Checking the Events of the ConfigMap Resource
50+
51+
After you update the [ConfigMap](configmap-and-annotations.md) resource, you can immediately check if the configuration was successfully applied by NGINX:
52+
```
53+
$ kubectl describe configmap nginx-config -n nginx-ingress
54+
Name: nginx-config
55+
Namespace: nginx-ingress
56+
Labels: <none>
57+
. . .
58+
Events:
59+
Type Reason Age From Message
60+
---- ------ ---- ---- -------
61+
Normal Updated 11s (x2 over 26m) nginx-ingress-controller Configuration from nginx-ingress/nginx-config was updated
62+
```
63+
Note how in the events section we have a Normal event with the Updated reason informing us that the configuration was successfully applied.
64+
65+
### Checking the Generated Config
66+
67+
For each Ingress resource, the Ingress Controller generates a corresponding NGINX configuration file in the `/etc/nginx/conf.d` folder. Additionally, the Ingress Controller generates the main configuration file `/etc/nginx/nginx.conf`, which includes all the configurations files from `/etc/nginx/conf.d`.
68+
69+
You can view the content of the main configuration file by running:
70+
```
71+
$ kubectl exec <nginx-ingress-pod> -n nginx-ingress -- cat /etc/nginx/nginx.conf
72+
```
73+
74+
Similarly, you can view the content of any generated configuration file in the `/etc/nginx/conf.d` folder.
75+
76+
You can also print all NGINX configuration files together:
77+
```
78+
$ kubectl exec <nginx-ingress-pod> -n nginx-ingress -- nginx -T
79+
```
80+
However, this command will fail if any of the configuration files is not valid.
81+
82+
### Checking the Live Activity Monitoring Dashboard
83+
84+
The live activity monitoring dashboard shows the real-time information about NGINX Plus and the applications it is load balancing, which is helpful for troubleshooting. To access the dashboard, follow the steps from [here](installation.md#5-access-the-live-activity-monitoring-dashboard--stub_status-page).
85+
86+
### Running NGINX in the Debug Mode
87+
88+
Running NGINX in the [debug mode](https://docs.nginx.com/nginx/admin-guide/monitoring/debugging/) allows us to enable its debug logs, which can help to troubleshoot problems in NGINX. Note that it is highly unlikely that a problem you encounter with the Ingress Controller is caused by a bug in the NGINX code, but it is rather caused by NGINX misconfiguration. Thus, this method is rarely needed.
89+
90+
To enable the debug mode, set the `error-log-level` to `debug` in the [ConfigMap](configmap-and-annotations.md) and use the `-nginx-debug` [command-line argument](cli-arguments.md) when running the Ingress Controller.

0 commit comments

Comments
 (0)