Ingress is healthchecking readiness probe every few seconds

12/8/2019

My Ingress, Service and Deployment:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: my-ip
    networking.gke.io/managed-certificates: my-certificate
spec:
  backend:
    serviceName: my-api-nodeport
    servicePort: 80
---
apiVersion: cloud.google.com/v1beta1
kind: BackendConfig
metadata:
  name: my-api-backendconfig
spec:
  timeoutSec: 43200
---
apiVersion: v1
kind: Service
metadata:
  name: my-api-nodeport
  annotations:
    beta.cloud.google.com/backend-config: '{"ports": {"80":"my-api-backendconfig"}}'
spec:
  type: NodePort
  selector:
    app: my-api
  ports:
    - port: 80
      targetPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-api
spec:
  replicas: 1
  selector:
    matchLabels:
      app: my-api
  template:
    metadata:
      labels:
        app: my-api
    spec:
      containers:
        - name: my-api
          image: gcr.io/acme/api
          readinessProbe:
            httpGet:
              path: /readinessProbe
              port: 80
          env:
            ...
          ports:
            - name: http
              containerPort: 80
            - name: https
              containerPort: 443

According to GKE UI, the Ingress healthcheck interval is 70 sec. However in practice I see lots of logs in my deployment to the readiness probe, about every couple of seconds.

2019-12-08 08:42:11 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request starting HTTP/1.1 GET http://10.16.62.83:80/readinessProbe
2019-12-08 08:42:11 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request finished in 0.1037ms 200
2019-12-08 08:42:16 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request starting HTTP/1.1 GET http://10.128.15.222/readinessProbe
2019-12-08 08:42:16 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request finished in 0.11610000000000001ms 200
2019-12-08 08:42:18 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request starting HTTP/1.1 GET http://10.128.15.222/readinessProbe
2019-12-08 08:42:18 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request finished in 0.10880000000000001ms 200
2019-12-08 08:42:19 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request starting HTTP/1.1 GET http://10.128.15.222/readinessProbe
2019-12-08 08:42:19 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request finished in 0.10790000000000001ms 200
2019-12-08 08:42:21 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request starting HTTP/1.1 GET http://10.16.62.83:80/readinessProbe
2019-12-08 08:42:21 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request finished in 0.14730000000000001ms 200
2019-12-08 08:42:27 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request starting HTTP/1.1 GET http://10.128.0.23/readinessProbe
2019-12-08 08:42:27 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request finished in 0.12040000000000001ms 200
2019-12-08 08:42:27 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request starting HTTP/1.1 GET http://10.128.0.23/readinessProbe
2019-12-08 08:42:27 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request finished in 0.1153ms 200
2019-12-08 08:42:28 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request starting HTTP/1.1 GET http://10.128.0.23/readinessProbe
2019-12-08 08:42:28 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request finished in 0.1563ms 200
2019-12-08 08:42:31 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request starting HTTP/1.1 GET http://10.16.62.83:80/readinessProbe
2019-12-08 08:42:31 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request finished in 0.11900000000000001ms 200
2019-12-08 08:42:36 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request starting HTTP/1.1 GET http://10.128.15.195/readinessProbe
2019-12-08 08:42:36 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request finished in 0.113ms 200
2019-12-08 08:42:36 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request starting HTTP/1.1 GET http://10.128.15.195/readinessProbe
2019-12-08 08:42:36 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request finished in 0.1153ms 200
2019-12-08 08:42:38 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request starting HTTP/1.1 GET http://10.128.15.195/readinessProbe
2019-12-08 08:42:38 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request finished in 0.1208ms 200
2019-12-08 08:42:41 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request starting HTTP/1.1 GET http://10.16.62.83:80/readinessProbe
2019-12-08 08:42:41 [INFO] Microsoft.AspNetCore.Hosting.Diagnostics: Request finished in 0.10600000000000001ms 200

Can I configure the interval to a lower rate?

-- Mugen
gke-networking
google-kubernetes-engine
kubernetes
kubernetes-ingress

1 Answer

12/8/2019

You can configure readiness probes as below

readinessProbe:
  exec:
    command:
    - cat
    - /tmp/healthy
  initialDelaySeconds: 5
  periodSeconds: 5

Please refer to the link https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ for further help.

-- dassum
Source: StackOverflow