Understanding healthchecks for backend services on GKE when using ingress

让人想犯罪 __ 提交于 2021-01-29 07:07:51

问题


I am using the following code in 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 

and I have the following in my 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   

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. 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: I am running a two node cluster and 2 pods, one on each node.


回答1:


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.



来源:https://stackoverflow.com/questions/51869789/understanding-healthchecks-for-backend-services-on-gke-when-using-ingress

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!