技术解析

非商业版本的 nginx 是否支持配置 health_check
0
2021-05-20 21:44:31
idczone
nginx/1.13.12

# kube.conf
upstream kubeapi {
        least_conn;
        zone kube_api_zone 64k;
        server 192.168.8.228:6443 max_fails=1 fail_timeout=30s;
        server 10.10.10.227:6443 max_fails=1 fail_timeout=30s;
        server 192.168.8.229:6443 max_fails=1 fail_timeout=30s;
}
server {
        listen        127.0.0.1:6443;
        proxy_pass    kubeapi;
        proxy_timeout 10m;
        proxy_connect_timeout 1s;
        health_check;
}

如果配置了,会提示提示unknown directive "health_check" in /etc/nginx/conf/sites_stream/kube.conf:13,是我的姿势不对么,基于 nginx 镜像,微调了 log 部分,还是是ngx_stream_upstream_hc_module在编译时就有配置上么?

附上:

#docker-compose.yaml
vers美国服务器ion: '2.1'
services:
  tcp-proxy:
    image: spanda/proxy:tcp
    container_name: tcp-proxy
    volumes:
      - /tmp/nginx/sites_stream:/etc/nginx/conf/sites_stream
      - /tmp/nginx/sites_http:/etc/nginx/conf/sites_http
      - /tmp/nginx/ssl:/etc/nginx/conf/ssl
    logging:
      driver: "json-file"
      options:
        max-size: "50m"
        max-file: "3"
    network_mode: "host"

不支持

试试 nginx_upstream_check_module 吧

回去我看看☺️

数据地带为您的网站提供全球顶级IDC资源
在线咨询
专属客服