【问题标题】:consul proxy change health endpoint领事代理更改健康端点
【发布时间】:2021-04-15 06:02:38
【问题描述】:

我在与“localhost”不同的主机上部署了一个 consul 代理,但 consul 继续检查 127.0.0.1 上的运行状况。

服务的配置和它的边车:

service {
  name = "counting"
  id = "counting-1"
  port = 9005
  address = "169.254.1.1"

  connect {
  sidecar_service {
      proxy {
        config {
        bind_address = "169.254.1.1"
        bind_port = 21002
        tcp_check_address = "169.254.1.1"
        local_service_address = "localhost:9005"
        }
      }
  }
  }
  check {
    id       = "counting-check"
    http     = "http://169.254.1.1:9005/health"
    method   = "GET"
    interval = "10s"
    timeout  = "1s"
  }
}

使用以下命令部署代理:

consul connect proxy -sidecar-for counting-1 > counting-proxy.log

Consul UI 的健康检查消息:

如何将健康检查改为 169.254.1.1?

【问题讨论】:

    标签: consul health-check servicemesh


    【解决方案1】:

    首先,我建议使用 Envoy 代理 (consul connect envoy) 而不是内置代理 (consul connect proxy),因为不建议将后者用于生产环境。

    至于更改健康检查地址,您可以通过设置proxy.local_service_address 来实现。为本地应用程序配置健康检查时使用此地址。

    有关此问题的相关讨论,请参阅 https://github.com/hashicorp/consul/issues/11008#issuecomment-929832280

    【讨论】:

      猜你喜欢
      • 2020-09-22
      • 1970-01-01
      • 1970-01-01
      • 2019-03-10
      • 2016-08-05
      • 1970-01-01
      • 2022-01-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多