kubernetesreadinessprobelivenessprobe

In kubernetes, can I have liveness probes but no readiness probes?


Trying to figure out if my pods sometimes restart is it because of the absence of readiness probes when liveness probes is enabled.

My pods sometimes restarting and thats not good. but Havent found on why is it happening. maybe it was because the readiness is disabled while liveness is enabled.

i found this here: https://itnext.io/understanding-kubernetes-probes-better-apps-health-checks-3a057341371a

enter image description here


Solution

  • Absence of readiness probe wont trigger Pod restart. Kubelet will restart the pod only when "failureThreshold" value is met which is configured in liveness probe. if its not configured default value will be used. This holds good for both startup or liveness probe. More details of about this parameter can be referred in k8s documentation

    Below is the sample of liveness probe with failure threshold

    livenessProbe:
      httpGet:
        path: /healthz
        port: liveness-port
      failureThreshold: 1
      periodSeconds: 60