Search code examples
envoyproxy

how can I use environment variables in the envoyproxy config file?


Until now the only solution that I found is use --config-yaml, something like that

envoy -c /etc/service-envoy.yaml \
    --config-yaml "'static_resources': {
    'clusters': [
      {
        'name': 'jaeger',
        'connect_timeout': '1s',
        'type': 'strict_dns',
        'lb_policy': 'round_robin',
        'hosts': [
          {
            'socket_address': {
              'address': '$JAEGER_HOST',
              'port_value': 9411
            }
          }
        ]
      }
    ]
  }"

Solution

  • I found the solution in this article, using envsubst

    https://blog.markvincze.com/how-to-use-envoy-as-a-load-balancer-in-kubernetes/

    cat /tmpl/envoy.yaml.tmpl | envsubst \$ENVOY_LB_ALG,\$SERVICE_NAME > /etc/envoy.yaml