Google Cloud GCP 不会转发到未通过健康检查的 Ingress。有人可以分享如何配置 Traefik Ingress 以通过健康检查吗?我认为它需要在 /health 上返回 200 或类似的内容。但确切的配置应该是什么样的?我正在使用参数而不是 toml 文件启动 traefik。谢谢。304 不接受。我认为一定是 200。
更新:这是我的部署。我认为这是正确的,但查看我收到的日志:
[29/Jun/2019:16:21:44 +0000] “GET /health HTTP/1.1” 404 19 “-” “kube-probe/1.13+” 4 “backend not found” “/health” 0ms 我如何设置以返回 200?
kind: Deployment
apiVersion: apps/v1
metadata:
name: traefik-ingress-controller
labels:
k8s-app: traefik-ingress-controller
spec:
replicas: 2
selector:
matchLabels:
k8s-app: traefik-ingress-controller
template:
metadata:
labels:
k8s-app: traefik-ingress-controller
name: traefik-ingress-controller
spec:
serviceAccountName: traefik-ingress-serviceaccount
terminationGracePeriodSeconds: 35
containers:
- image: traefik
name: traefik-ingress-controller
imagePullPolicy: Always
resources:
limits:
cpu: 200m
memory: 384Mi
requests:
cpu: 25m
memory: 128Mi
livenessProbe:
failureThreshold: 2
httpGet:
path: /health
port: 80
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 5
readinessProbe:
failureThreshold: 2
httpGet:
path: /health
port: 80
scheme: HTTP
periodSeconds: 5
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
- name: dashboard
containerPort: 8080
args:
- --logLevel=DEBUG
- --api
- --api.dashboard=true
- --kubernetes
- --accesslog=true
答案1
使用 Traefik平定义可用于向 Traefik 添加健康检查端点。使用方式如下:
defaultEntryPoints = ["http"]
[entryPoints]
[entryPoints.http]
address = ":80"
[ping]
entryPoint = "http"
它将添加
200
用于检查 Traefik 进程活跃性的简单端点。返回包含以下内容的代码:OK