[英]ECS fargate with consul-agent and proxy as sidecar container
I am trying to implement consul-agent and proxy as sidecar container inside my ECS fargate service.我正在尝试在我的 ECS fargate 服务中将 consul-agent 和 proxy 实现为 sidecar 容器。 So, inside the task, there will be 3 containers running:
因此,在任务内部,将运行 3 个容器:
All containers are up and running on ECS task.所有容器都已启动并在 ECS 任务上运行。 The node has registered in the consul UI as well.
该节点也已在 consul UI 中注册。 But, the service is not up in the consul UI.
但是,该服务不在 consul UI 中。
I dig in and found the log of 'consul-agent-container', Here is the error log:我挖掘并找到了'consul-agent-container'的日志,这是错误日志:
2021/03/12 03:33:14 [ERR] http: Request PUT /v1/agent/check/pass/greeting-fargate-proxy-ttl?note=, error: CheckID "greeting-fargate-proxy-ttl" does not have associated TTL from=127.0.0.1:43252
2021/03/12 03:33:14 [ERR] http:请求 PUT /v1/agent/check/pass/greeting-fargate-proxy-ttl?note=,错误:CheckID“greeting-fargate-proxy-ttl”确实没有关联的 TTL from=127.0.0.1:43252
Here are the commands I used to connect consul.这是我用来连接 consul 的命令。
"exec consul agent -ui -data-dir /consul/data -client="127.0.0.1" -bind="{{ GetPrivateIP }}" -retry-join "172.31.79.139""
"执行领事代理 -ui -data-dir /consul/data -client="127.0.0.1" -bind="{{ GetPrivateIP }}" -retry-join "172.31.79.139""
"exec consul connect proxy -register -service greeting-fargate -http-addr 127.0.0.1:8500 -listen 127.0.0.1:8080 -service-addr 127.0.0.1:3000"
“执行领事连接代理-register -service greeting-fargate -http-addr 127.0.0.1:8500 -listen 127.0.0.1:8080 -service-addr 127.0.0.1:3000”
HashiCorp recently announced support for running Consul service mesh on ECS using Terraform to deploy the agent and sidecar components. HashiCorp 最近宣布支持在 ECS 上运行 Consul 服务网格,使用 Terraform 部署代理和边车组件。 You might want to consider this as an alternative solution to your existing workflow.
您可能希望将此视为现有工作流程的替代解决方案。
This solution is currently in tech preview.此解决方案目前处于技术预览阶段。 You can find more information in the blog post https://www.hashicorp.com/blog/announcing-consul-service-mesh-for-amazon-ecs .
您可以在博客文章https://www.hashicorp.com/blog/announcing-consul-service-mesh-for-amazon-ecs中找到更多信息。
I did not manage to get my proxy to work using the same method as you were using.我没有设法让我的代理使用与您使用的方法相同的方法工作。 But I remember reading somewhere that you should declare your Connect proxy inside the service registration config
但我记得在某处读过你应该在服务注册配置中声明你的 Connect 代理
{
"service": {
"name": "web",
"port": 8080,
"connect": { "sidecar_service": {} }
}
}
After you have done that I think you could just launch your proxy using:完成后,我认为您可以使用以下命令启动代理:
consul connect proxy -sidecar-for <service-id>
I did not verify this because the application I was using used Spring Cloud Consul to register the services and I did not find where to register a proxy, but maybe this can help you further.我没有验证这一点,因为我使用的应用程序使用 Spring Cloud Consul 来注册服务,我没有找到在哪里注册代理,但也许这可以帮助你进一步。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.