Understanding healthchecks for backend services on GKE when using ingress

8/16/2018

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.

-- kosta
google-kubernetes-engine
kubernetes-health-check

1 Answer

8/16/2018

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.

-- Alioua
Source: StackOverflow