Kubernetes Container Probes: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 26: Line 26:
     readinessProbe|livenessProbe:
     readinessProbe|livenessProbe:
       exec:
       exec:
Example:
readinessProbe:
  exec:
    command:
    - /bin/sh
    - -c
    - nodetool status | grep -E "^UN\s+${POD_IP}"
      failureThreshold: 3
      initialDelaySeconds: 90
      periodSeconds: 30
      successThreshold: 1
      timeoutSeconds: 5

Revision as of 23:11, 2 October 2019

External

Internal

Overview

Container Liveness Check

The result of the container liveness check is used by Kubernetes to know when to restart the container (Not the pod? How about atomicity?)

Container Readiness Check

The result of the container readiness check is used by Kubernetes to know when the container is ready to accept traffic. The pod is considered ready wen all of its containers are ready. The readiness check is used by services to decide whether to send traffic into the pod or not. Container will be removed from service endpoints if the probe fails.

Probe Template

https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.14/#probe-v1-core
kind: Pod
spec:
  containers:
  - name: ...
    readinessProbe|livenessProbe:
      exec:

Example:

readinessProbe:
  exec:
    command:
    - /bin/sh
    - -c
    - nodetool status | grep -E "^UN\s+${POD_IP}"
     failureThreshold: 3
     initialDelaySeconds: 90
     periodSeconds: 30
     successThreshold: 1
     timeoutSeconds: 5