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.

# namespace of your nginx ingress
ingress_ns="default"

# find running pod
podname=$(kubectl get pods -n $ingress_ns -l app.kubernetes.io/name=ingress-nginx --field-selector=status.phase==Running -o jsonpath='{.items[0].metadata.name}'
)

echo "pod name: $podname"

# invoke controller with version flag
kubectl exec -it -n $ingress_ns $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