我试图从特使文档中设置一个基本的特使代理(使用Docker),但我不断收到如下解析错误:

[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:238] initializing epoch 0 (hot restart version=11.104)
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:240] statically linked extensions:
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:242]   access_loggers: envoy.file_access_log,envoy.http_grpc_access_log
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:245]   filters.http: envoy.buffer,envoy.cors,envoy.csrf,envoy.ext_authz,envoy.fault,envoy.filters.http.dynamic_forward_proxy,envoy.filters.http.grpc_http1_reverse_bridge,envoy.filters.http.header_to_metadata,envoy.filters.http.jwt_authn,envoy.filters.http.original_src,envoy.filters.http.rbac,envoy.filters.http.tap,envoy.grpc_http1_bridge,envoy.grpc_json_transcoder,envoy.grpc_web,envoy.gzip,envoy.health_check,envoy.http_dynamo_filter,envoy.ip_tagging,envoy.lua,envoy.rate_limit,envoy.router,envoy.squash
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:248]   filters.listener: envoy.listener.original_dst,envoy.listener.original_src,envoy.listener.proxy_protocol,envoy.listener.tls_inspector
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:251]   filters.network: envoy.client_ssl_auth,envoy.echo,envoy.ext_authz,envoy.filters.network.dubbo_proxy,envoy.filters.network.mysql_proxy,envoy.filters.network.rbac,envoy.filters.network.sni_cluster,envoy.filters.network.thrift_proxy,envoy.filters.network.zookeeper_proxy,envoy.http_connection_manager,envoy.mongo_proxy,envoy.ratelimit,envoy.redis_proxy,envoy.tcp_proxy
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:253]   stat_sinks: envoy.dog_statsd,envoy.metrics_service,envoy.stat_sinks.hystrix,envoy.statsd
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:255]   tracers: envoy.dynamic.ot,envoy.lightstep,envoy.tracers.datadog,envoy.tracers.opencensus,envoy.zipkin
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:258]   transport_sockets.downstream: envoy.transport_sockets.alts,envoy.transport_sockets.tap,raw_buffer,tls
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:261]   transport_sockets.upstream: envoy.transport_sockets.alts,envoy.transport_sockets.tap,raw_buffer,tls
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:267] buffer implementation: old (libevent)
[2019-09-30 11:16:05.318][1][critical][main] [source/server/server.cc:93] error initializing configuration '/etc/envoy/envoy.yml': Unable to parse JSON as proto (INVALID_ARGUMENT:Unexpected token.
admin:
  access_log
^): admin:
  access_log_path: /tmp/admin_access.log
  address:
    socket_address: { address: 127.0.0.1, port_value: 9901 }

static_resources:
  listeners:
  - name: listener_0
    address:
      socket_address: { address: 127.0.0.1, port_value: 10000 }
    filter_chains:
    - filters:

如您所见,这是从JSON到Proto的解析错误,但是我不知道我从网站上的文档中提取的位置。除非文档过时!以下是我的envoy.yml文件:
admin:
  access_log_path: /tmp/admin_access.log
  address:
    socket_address: { address: 127.0.0.1, port_value: 9901 }

static_resources:
  listeners:
  - name: listener_0
    address:
      socket_address: { address: 127.0.0.1, port_value: 10000 }
    filter_chains:
    - filters:
      - name: envoy.http_connection_manager
        typed_config:
          "@type": type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager
          stat_prefix: ingress_http
          codec_type: AUTO
          route_config:
            name: local_route
            virtual_hosts:
            - name: local_service
              domains: ["*"]
              routes:
              - match: { prefix: "/" }
                route: { cluster: some_service }
          http_filters:
          - name: envoy.router
  clusters:
  - name: some_service
    connect_timeout: 0.25s
    type: STATIC
    lb_policy: ROUND_ROBIN
    load_assignment:
      cluster_name: some_service
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: 127.0.0.1
                port_value: 1234

这是我的docker-compose文件的使节部分:
 envoy:
    image: envoyproxy/envoy:v1.11.1
    command: /usr/local/bin/envoy -c /etc/envoy/envoy.yml -l debug --service-cluster proxy
    container_name: envoy
    ports:
      - 8070:12000
    volumes:
      - ./scripts/envoy/envoy.yml:/etc/envoy/envoy.yml
    networks:
      - mongo-cluster

最佳答案

发现了问题,我很傻,我知道我一定很傻,但是直到我发布问题大声笑之前我都无法弄清楚。

问题出在我的Yaml文件扩展名上。我使用的是.YML而不是.YAML
我不知道为什么VS Code识别了让我失望的扩展。

07-27 16:42