nginx-ingress within kuberntes / how to enable and use geoip?

8/30/2018

Just realized that geoip was present by default within the nginx-ingress in the context of kubernetes; that is, looked around, being new into nginx geoip, I don't have much clue about how to benefit from this

Firstly, is there any declarative setup to effectively have it working ? A configmap setup, or so ?

Secondly, how such info is passed from the nginx-ingress to an app ? Is the info present in the headers ? is there any extra setup to apply ?

thanks a lot for any experienced input; best

-- Ben
geoip
kubernetes
nginx-ingress

1 Answer

8/30/2018

The nginx_http_geoip_module module creates variables with values depending on the client IP address, using the precompiled MaxMind databases.

This module is not built by default, it should be enabled with the --with-http_geoip_module configuration parameter.

The module analyze headers, next connect to defined database, fetch the localization information and offers a variables regarding to them like country or city of connection origin. Some examples:

$geoip_country_code - two-letter country code

$geoip_city - city name

$geoip_postal_code - postal code

-- d0bry
Source: StackOverflow