Liveness, Readiness, and Startup probes are well-known methods to detect Pod health in Kubernetes. They are used in regular uptime monitoring and enable initial startup health that allows rolling deploys of new service updates.
The example below will define Liveness, Readiness, and Startup probes to one service deployment.
While creating a deployment, provide the below configuration to set up probes for your service.
Other Container Config
# setup http livenessProbe# To perform a probe, the kubelet sends an HTTPGET request# Service is considered healthy when /healthz retuns success codelivenessProbe:httpGet:path:/healthz#endpoint pathport:8080initialDelaySeconds:3#first Liveness check to be performed after 3 seconds.periodSeconds:3#verify the liveness of the application every 3 seconds# setup http readinessProbereadinessProbe:httpGet:path:/healthzport:8080initialDelaySeconds:5periodSeconds:5# setup http startupProbestartupProbe:initialDelaySeconds:1periodSeconds:5timeoutSeconds:1successThreshold:1failureThreshold:1exec:command: - cat - /etc/nginx/nginx.conf
In addition to the httpGet example, TCP Probes can be configured from the Other Container Config field: