求教nginx 配置health_check

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;
}

提示health_check unknown directive "health_check" in /etc/nginx/conf/sites_stream/kube.conf:13

参考这个Module ngx_stream_upstream_hc_module

#docker-compose.yaml
version: '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"

只有商业版本支持吗?

阅读 7.2k
1 个回答

这个模块并不需要商业版本,但也不包含在标准的发行包里,需要单独编译,才能安装。
参考下面的官方文档。

https://www.nginx.com/resourc...

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题