nginx - How add nginx-ingress custom health check behind a nginx reverse proxy
问题描述
I have a nginx server outside kubernetes. nginx -> nginx ingress
. I want know how add a custom health check path /health/status
to nginx ingress.
解决方案
这个问题几乎肯定是在解决错误的问题,但本着回答所问问题的精神:
您可以将 Ingress 暴露/healthz
给外界:
kind: Service
metadata:
name: ingress-nginx-health
spec:
type: ClusterIP
selector: # whatever
ports:
- name: healthz
port: 80
targetPort: 10254
---
kind: Ingress
spec:
rules:
- host: elb-1234.example.com
http:
path: /healthz
backend:
serviceName: ingress-nginx-health
servicePort: healthz
因为如果你的 Ingress 控制器摔倒了,它肯定会停止回答自己的 healthz 检查
推荐阅读
- google-apps-script - 使用 Apps 脚本将数据发布到 Notion 中的表格
- c# - 如何在 MVC 的列表中自动添加产品 ID
- firebase - 如何将数据放入可点击的列表磁贴中,点击磁贴时显示相关数据
- node.js - 与 Mongo Compass 中某些字段的路径冲突
- visual-studio-code - 在 VSCode 中的 OCaml 中编码时注释选定文本的快捷方式
- csv - 测试重复的 CSV 文件?
- java - 为什么 getRequestUrl() 返回 StringBuffer 而不是 String?
- python - 基于概率做出选择 - Python
- angular - NullInjectorError 尝试使用 URL 路由翻译 Angular 内容?
- php - 是否可以在不重新加载页面的情况下显示 if else php 语句的结果