Debugging and troubleshooting patterns for NIC. Use when diagnosing failures, tracing issues, investigating NGINX reload errors, config generation bugs, or controller sync problems.
68
83%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Symptom: Controller logs show "reload failed" or NGINX returns error status.
Diagnosis:
nginx -t output in logs — shows exact syntax error and line numbercontainsDangerousChars() check){{- if }} / {{- with }}) for optional fieldFix pattern:
make test — snapshot tests catch most template output issuesSymptom: User applies VirtualServer/Policy but NGINX config doesn't change.
Diagnosis:
kubectl get vs <name> -o yaml — look at .status.messagestatus.state: Invalid)Symptom: Pod restarts, panic in logs.
Diagnosis:
*bool/*int check).Spec.X fieldinternal/configs/ or internal/k8s/Symptom: make test fails with snapshot mismatch.
Diagnosis:
make test-update-snaps to regenerate| Context | Location | What to look for |
|---|---|---|
| Controller logs | Pod stdout/stderr | Sync errors, reload status, validation failures |
| NGINX error log | /var/log/nginx/error.log in container | Config syntax errors, upstream failures |
| NGINX access log | /var/log/nginx/access.log in container | Request routing verification |
| Tool | Command | Purpose |
|---|---|---|
| Config test | nginx -t (inside container) | Validate NGINX config syntax |
| CRD status | kubectl get vs,vsr,ts,pol -A | Check resource state |
| Controller logs | kubectl logs <pod> -n nginx-ingress | Runtime errors |
| Describe events | kubectl describe vs <name> | Kubernetes events for the resource |
| Generated config | kubectl exec <pod> -- cat /etc/nginx/conf.d/<file> | Inspect actual generated NGINX config |
status.state: Invalid with reasonmake test passes, snapshot output is correctWhen the generated NGINX config is wrong:
internal/configs/version2/http.go (VS) or internal/configs/version1/config.go (Ingress)internal/configs/virtualserver.go or internal/configs/ingress.go.tmpl file renders it? Check internal/configs/version2/nginx-plus.virtualserver.tmpl or the OSS variant_test.go file with the input that triggers the bug, run make test-update-snaps to capture current (wrong) output, then fix and regenerategeneratePolicies() logiccontainsDangerousChars() failures are validation errors and typically result in status.state: Invalid — check the CRD status message and controller logsWhen debugging an issue that involves user-provided input reaching NGINX config:
;, {, }, $, newlines, backticks in the user-controlled value.containsDangerousChars() or ValidateEscapedString() cover this path? If not, the bug is a security vulnerability.0eb3072
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.