I've set up a Node app on Kubernetes and have set up an Ingress. As a result, my node server gets constantly bombarded with Health Checks.
I'm not sure if these constant health checks are a good or a bad thing. Are they going to affect the server (e.g slow it down, or keep it continuously busy) ? This could also result in increased CPU usage of my App?
What's the best practice here?
I set up my Ingress like this
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: kubernetes-ingress
# kubernetes-ingress is the name of static ip we've reserved in Google Cloud
annotations:
kubernetes.io/ingress.global-static-ip-name: "kubernetes-ingress"
spec:
# spec:
tls:
- hosts:
- app.com
secretName: ingress-ssl
backend:
serviceName: web
servicePort: 3000
Health check is a basic Kubernetes feature meaning you are OK. I do not see any problem in your Ingress.
Kubernetes Health checks can be divided into liveness
and readiness
probes.
Readiness probes
are used to check if your application inside the Pod is ready to serve the network traffic or not. If the readiness probe for your application fails, then that Pod is removed from the endpoints that make up a service. By using a readiness probe
, Kubernetes waits until the app is fully started before allowing the service to send network traffic to this Pod.
The purpose of liveness probes
is to indicate that your application is up and running. If Kubernetes detects that your application inside the Pod is alive, there are no further actions expected, in the other case, the failed Pod will be removed, and the system will attempt to start the new Pod.
Liveness
and readiness
probes really help with the stability of applications across your Kubernetes cluster ensuring that network traffic goes only to instances that can serve it and also detects application crash or failure in the Pod in order to replace it with a new one.
To sum up, as @Oron Golan mentioned Health check
is a native Kubernetes feature and it should not degrade your application overall performance.
Find more information about Best practices of using Kubernetes Health checks Here.
Health check is normal config which enables stability of your apps in distributed setup. If you getting too many requests, there are ways to configure, how frequently Kubernetes must query your service to check health and liveliness. You can tune it according to your application behavior/load/other deployment configs.