【问题标题】:Using consul-template to render 2000+ services to nginx.conf使用 consul-template 向 nginx.conf 渲染 2000 多个服务
【发布时间】:2020-08-16 07:05:28
【问题描述】:

我们有一个使用 consul-template 生成的 nginx 配置文件,用于 2000 多个服务,运行 Consul 1.6.1。

我们正在尝试升级到 Consul 1.7.2 并遇到 consul-template DDoSes Consul 节点代理的问题。

节点/客户端代理 v1.6.1 工作正常,但节点/客户端代理 v1.7.2 开始拒绝来自 consul-template 的连接。

有问题的模板(简化版)是:

{{- range services }}
{{- if (in .Tags "nginxqa1") }}
{{- range service .Name }}
{{ .Address }}
{{- end }}
{{- end }}
{{- end }}

在节点/客户端领事上添加以下限制配置条目似乎可以解决问题:

http_max_conns_per_client = 5000

但是,这有什么影响吗?

有没有更好的方法来做到这一点? 我看到了这些消息:

2020/05/01 18:24:51.653257 [WARN] (runner) watching 2631 dependencies - watching this many dependencies could DDoS your consul cluster

任何想法/建议表示赞赏。

【问题讨论】:

    标签: consul consul-template


    【解决方案1】:

    http_max_conns_per_client 参数是在hashicorp/consul#7159 中引入的,用于地址CVE-2020-7219。对于大多数用例来说,默认值 200 似乎是一个合理的默认值。但是,在像您这样的情况下,提高此值是有意义的。

    提出此问题的唯一缺点是任何能够与 Consul API 通信的客户端都将能够创建多达 5000 个连接。不能仅针对特定客户提高此限制。在将这些更改推送到生产环境时请记住这一点。

    【讨论】:

      猜你喜欢
      • 2013-03-21
      • 2020-07-30
      • 2013-05-26
      • 1970-01-01
      • 2012-11-10
      • 2019-12-16
      • 2021-09-21
      • 2017-08-08
      • 2013-02-04
      相关资源
      最近更新 更多