Liveness Probe

Liveness probe is used to check if containers or apps in pods are healthy and still able to take requests. It is required to make sure that the applications are healthy post initial start.

Similar to readiness probe, developers have to specify the endpoints, port for tcp socket and command for cli application which can be accessed by kubernetes to decide that the applications are healthy.

    containers:
        - name: http-server
          image: http-server
          livenessProbe:
              httpGet:
                  path: '/api/healthy'
                  port: 8088
        - name: database
          image: db
          livenessProbe:
              tcpSocket:
                  port: 3306
        - name: cli-app
          image: cli-app
          livenessProbe:
              exec:
                  command:
                    - cat
                    - /is_healthy.txt

Here also we can specify additional options similar to readiness probe:

  1. initialDelaySeconds
  2. periodSeconds
  3. failureThreshold