如何在 envoyproxy 配置文件中使用环境变量?

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

到目前为止,我找到的唯一解决方案是使用 --config-yaml,类似的东西

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
            }
          }
        ]
      }
    ]
  }"

我在这篇文章中找到了解决方案,使用 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