Search code examples
kuberneteskubernetes-ingresskong

Pass custom environmental variables into Kong ingress controller


So, I need to pass extra env variable to my custom plugin. In docker compose I just do this:

- DATABASE_HOST=mysql:3306
- DATABASE_PASSWORD=mysql
- DATABASE_USER=root
- DATABASE_NAME=kong
- "KONG_NGINX_MAIN_ENV=DATABASE_HOST; env DATABASE_PASSWORD; env DATABASE_USER; env DATABASE_NAME"

As you can see it uses Nginx env directive, this is working fine

However I don't know how to do the same with the Kong ingress controller, according to the chart value description:

Specify Kong configuration This chart takes all entries defined under .env and transforms them into into KONG_* environment variables for Kong containers. Their names here should match the names used in https://github.com/Kong/kong/blob/master/kong.conf.default See https://docs.konghq.com/latest/configuration also for additional details

  env:
    log_level: info
    my_custom_var: hello

So if I put my custom variable there it will be transformed into KONG_MY_CUSTOM_VAR

So how can I do it? I cannot find where the Kong chart exposes additional environmental variables.


Solution

  • According to the maintainers of the chart, this is not currently possible. I will try to make PR to fix this.