首页 文章

GCE Ingress没有从准备情况调查中获取 Health 检查

提问于
浏览
1

当我创建GCE入口时,Google Load Balancer不会从准备情况探测中设置运行状况检查 . 根据文件(Ingress GCE health checks),它应该接受它 .

在支持服务的pod上公开任意URL作为准备探测 .

有什么想法吗?

部署:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: frontend-prod
  labels:
    app: frontend-prod
spec:
  selector:
    matchLabels:
      app: frontend-prod
  replicas: 3
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: frontend-prod
    spec:
      imagePullSecrets:
        - name: regcred
      containers:
      - image: app:latest
        readinessProbe:
          httpGet:
            path: /healthcheck
            port: 3000
          initialDelaySeconds: 15
          periodSeconds: 5
        name: frontend-prod-app
      - env:
        - name: PASSWORD_PROTECT
          value: "1"
        image: nginx:latest
        readinessProbe:
          httpGet:
            path: /health
            port: 80
          initialDelaySeconds: 5
          periodSeconds: 5
        name: frontend-prod-nginx

服务:

apiVersion: v1
kind: Service
metadata:
  name: frontend-prod
  labels:
    app: frontend-prod
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 80
    protocol: TCP
    name: http
  selector:
    app: frontend-prod

入口:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: frontend-prod-ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: frontend-prod-ip
spec:
  tls:
    - secretName: testsecret
  backend:
    serviceName: frontend-prod
    servicePort: 80

2 回答

  • 1

    显然,您需要在PodSpec上包含容器端口 . 似乎没有在任何地方记录 .

    例如

    spec:
          containers:
          - name: nginx
            image: nginx:1.7.9
            ports:
            - containerPort: 80
    

    谢谢Brian! https://github.com/kubernetes/ingress-gce/issues/241

  • -1

    GKE Ingress运行状况检查路径目前无法配置 . 您可以转到http://console.cloud.google.com(UI)并访问Load Balancers列表以查看它使用的运行状况检查 .

    目前,在Ingress上指定的每个 backend: 上,Ingress的 Health 检查是 GET / . 因此,GKE Ingress背后的所有应用程序必须将HTTP 200 OK返回到 GET / 请求 .

    也就是说,您在Pod上指定的 Health 检查仍在使用 - 通过kubelet确保您的Pod实际上正常运行且 Health .

相关问题