我正在尝试使用 Amazon Elastic Container Service (ECS) 上的 Envoy Sidecar 容器设置 Envoy 前端代理,参考此关联。
Envoy Sidecar 配置如下:
#service-envoy.yaml
static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 80
filter_chains:
- filters:
- name: envoy.http_connection_manager
config:
codec_type: auto
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: service
domains:
- "*"
routes:
- match:
prefix: "/service"
route:
cluster: local_service
http_filters:
- name: envoy.router
config: {}
clusters:
- name: local_service
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
hosts:
- socket_address:
address: 127.0.0.1
port_value: 8080
admin:
access_log_path: "/dev/null"
address:
socket_address:
address: 0.0.0.0
port_value: 8081
前端代理特使配置:
#front-envoy.yaml
static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 80
filter_chains:
- filters:
- name: envoy.http_connection_manager
config:
codec_type: auto
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: backend
domains:
- "*"
routes:
- match:
prefix: "/service"
route:
cluster: testservice
http_filters:
- name: envoy.router
config: {}
clusters:
- name: testservice
connect_timeout: 0.25s
type: logical_dns
lb_policy: round_robin
http2_protocol_options: {}
hosts:
- socket_address:
# this is the ecs service discovery endpoint for our service
address: testservice.ecs
port_value: 80
admin:
access_log_path: "/dev/null"
address:
socket_address:
address: 0.0.0.0
port_value: 8001
我能够将 Envoy 设置并测试为 Sidecar,但 Envoy 前端代理一直给我 http 错误代码 503。
我究竟做错了什么?
答案1
问题出在 ECS 集群服务命名空间中,我创建了一个唯一的命名空间并在该命名空间下分配了我所有的集群服务,然后它就开始工作了。
之前我采用了默认的集群服务命名空间,但它不知何故不起作用。