diff --git a/README.md b/README.md index d89b878..acb3fc9 100644 --- a/README.md +++ b/README.md @@ -92,4 +92,7 @@ Running job helm-info... OK Running job helm-deployments... OK Supportpkg successfully generated: nic-supportpkg-1711384966.tar.gz -``` \ No newline at end of file +``` + +## The nginx-utils Package +Please refer to its dedicated [README](/nginx-utils/README.md). \ No newline at end of file diff --git a/nginx-utils/README.md b/nginx-utils/README.md new file mode 100644 index 0000000..69a12a1 --- /dev/null +++ b/nginx-utils/README.md @@ -0,0 +1,50 @@ +# Introduction +The `kubectl` command of Kubernetes offers a `debug` sub-command to investigate pods running (or crashing) on a node using ephemeral debug containers. +The `nginx-utils` image can be spun into a debug container that includes various tools such as curl, tcpdump, iperf, netcat to name a few. + +Benefits: +* Minimal image +* Scanned for vulnerabilities +* Includes well-known troubleshooting tools +* Ability to include custom tools + +# Usage +#### The command to start the debug container using the nginx-utils image version `ghcr.io/nginx/nginx-utils:latest`: +``` +kubectl -n debug -it --image=ghcr.io/nginx/nginx-utils:latest --target=nginx-ingress +``` + +Please refer to the [nginx-utils packages page](https://github.com/nginx/nginx-supportpkg-for-k8s/pkgs/container/nginx-utils) for versions. + +-------------- +#### Example usage of `api_stats.sh` found in the container: +The `api_stats.sh` script is designed to facilitate accessing the [/api](https://nginx.org/en/docs/http/ngx_http_api_module.html#api) endpoint to query various status information, configuring upstream server groups on-the-fly, and managing key-value pairs without the need of reconfiguring nginx. + +> **NOTE:** The `api_stats.sh` script requires an `/api` endpoint that is listening on `loopback`, in a given `port`. +``` +kubectl -n debug -it --image=ghcr.io/nginx/nginx-utils:latest --target=nginx-ingress + +v4nic-0-nginx-ingress-controller-854796ff97-hhkk5:~# ls +api_stats.sh memory_stats.sh + +v4nic-0-nginx-ingress-controller-854796ff97-hhkk5:~# ./api_stats.sh -h + +Usage: ./api_stats.sh [-p port] + +v4nic-0-nginx-ingress-controller-854796ff97-hhkk5:~# ./api_stats.sh -p 8080 +API_VERSION: 9 +**** /api/9/nginx **** +{ + "version": "1.27.2", + "build": "nginx-plus-r33-p2", + "address": "127.0.0.1", + "generation": 8, +.... +} +``` + +# Building +Please go to the root directory of this project, `nginx-supportpkg-for-k8s` and run the command: +``` +make nginx-utils +``` \ No newline at end of file