简体   繁体   English

带有 consul-agent 和代理的 ECS fargate 作为 sidecar 容器

[英]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 个容器:

  • core-business-service-container核心业务服务容器
  • consul-agent-container领事代理容器
  • core-business-consul-proxy-container核心业务领事代理容器

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 的命令。

  1. consul-agent-container:领事代理容器:

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

  1. core-business-consul-proxy-container:核心业务领事代理容器:

"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.

相关问题 如何在扩展ECS实例时自动运行consul代理和registrator容器 - How to automatically run consul agent and registrator container on scaling ECS instance 如何在Fargate启动类型实例上更新AWS ECS容器代理 - how to update AWS ECS Container Agent on Fargate launch type instances 在 ECS Fargate 上运行 consul-master 服务器 - Running consul-master servers on ECS Fargate 我的应用程序如何在 AWS App Mesh(具有动态端口的 ECS/Fargate)上发现 *local* 特使边车代理的地址/端口? - How does my application discover the address/port of the *local* envoy sidecar proxy on AWS App Mesh (ECS/Fargate with dynamic ports)? 如何通过在 CloudFormation 的不同 Fargate 任务中运行的 Consul 服务器将 Consul 代理加入 Consul 集群? - How can I join a Consul agent to a Consul cluster via a Consul server running in a different Fargate task with CloudFormation? 使用 Terraform 订购 AWS ECS Fargate 容器 - AWS ECS Fargate container ordering with Terraform AWS ECS Fargate 容器运行状况检查命令 - AWS ECS Fargate Container Healthcheck command 如何增加 ECS FARGATE 容器存储 - How to Increase ECS FARGATE Container Storage 是否可以获取 ecs fargate 的容器 ID 或名称? - Is it possible to fetch container ID or Name of ecs fargate? ECS Fargate:Logstash容器共享卷 - ECS Fargate : Logstash container sharing volumes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM