使用入口时了解GKE上后端服务的运行状况检查 [英] Understanding healthchecks for backend services on GKE when using ingress

查看:68
本文介绍了使用入口时了解GKE上后端服务的运行状况检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 statefulset.yml

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: geth
  namespace: prod
spec:
  serviceName: geth-service
  replicas: 2
  selector:
    matchLabels:
      app: geth-node
  template:
    metadata:
      labels:
        app: geth-node
    spec:
containers:
      - name: geth-node
        image: <My image>
        imagePullPolicy: Always
        livenessProbe:
          httpGet:
              path: /
              port: 8545
          initialDelaySeconds: 20 #wait this period after staring fist time
          periodSeconds: 15  # polling interval
          timeoutSeconds: 5    # wish to receive response within this time period
        readinessProbe: 
          httpGet:
              path: /
              port: 8545
          initialDelaySeconds: 20 #wait this period after staring fist time
          periodSeconds: 15    # polling interval
          timeoutSeconds: 5 

并且我的 ingress.yml

kind: Ingress
apiVersion: extensions/v1beta1
metadata:
  name: prod-ingress
  namespace: prod
  annotations:
    kubernetes.io/ingress.class: "gce"
    kubernetes.io/ingress.global-static-ip-name: "mystaticip"
spec:
  tls:
    - secretName: my-tls
      hosts: 
        - myhost.com
  rules:
    - host: myhost
      http:
        paths:
        - path: /rpc
          backend:
            serviceName: gethrpc-service
            servicePort: 80   

我的容器暴露了端口 8545 ,因此我为我的 statefulset 配置了探针.

My container is exposing the port 8545, so I configured the probe as above for my statefulset.

创建此状态集和入口时,会自动创建一个负载均衡器.

When I create this statefulset and ingress, a load balancer is automatically created.

我有两个后端服务(我认为两个节点有两个端口-我在两个节点上运行它)

I get two Backend services ( I think two ports for two nodes - I am running it on two nodes)

但是,我对为这些后端服务创建的以下两项运行状况检查感到困惑.

However, I am confused about the following two healthchecks created for these backend services.

1. Path: /healthz Port number: 30695
2. Path: / Port number: 30190   

  1. 我不明白为什么这些健康检查对于不同的节点会有所不同.
  2. 我将路径配置为/,因此IMO都应该具有路径/
  1. I don't understand why these health checks are different for different nodes.
  2. I configured the path to be /, so IMO both should have had the path /

PS:我正在运行一个两个节点的集群和两个Pod,每个节点一个.

PS: I am running a two node cluster and 2 pods, one on each node.

推荐答案

路径[/healthz ]用于GLBC的默认后端,请查看

The path [/healthz] is used for the default Backend for GLBC, take a look here. As you know The default backend is a service which handles all URL paths and hosts the GLBC controller doesn't understand.

路径[/]最有可能为您服务.

The path [/] is most probably for you service.

这篇关于使用入口时了解GKE上后端服务的运行状况检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆