Kubernetes: detecting the installed version of nginx ingress

If you need to determine the version of the nginx ingress controller deployed, then you can invoke the ingress controller binary with the ‘–version’ flag.

But this binary is located in the ingress-nginx-controller pod, so do a ‘kubectl exec’ like below.

# show all running nginx ingress pods
kubectl get pods -n $ingress_ns -l app.kubernetes.io/name=ingress-nginx --field-selector=status.phase==Running -A --output=custom-columns="ns:.metadata.namespace,name:.metadata.name" --no-headers

# pick one of the namespaces and pod names from list above
ingress_ns="ingress-nginx"
ingress_podname="ingress-nginx-controller-abc-xyz"

# invoke controller with version flag
kubectl exec -it -n $ingress_ns $ingress_podname -- /nginx-ingress-controller --version

Which will output something similar to:

NGINX Ingress controller
Release: v0.45.0
Build: 7365e9eeb2f4961ef94e4ce5eb2b6e1bdb55ce5c
Repository: https://github.com/kubernetes/ingress-nginx
nginx version: nginx/1.19.6

REFERENCES

kubernetes docs, ingress-nginx deployment