liveBook · Manning

Probe

As explained in Kubernetes for Developers

A liveness or readiness probe is a Kubernetes health check that determines whether a container should be restarted or can receive traffic.

A probe lets Kubernetes check whether a container is healthy and able to serve traffic. Liveness checks support restarting unhealthy containers, while readiness checks indicate whether a container should receive traffic. section 1.2.2

Choose the probe mechanism that matches the workload. HTTP services expose a health endpoint, other network services accept TCP connections, and workloads without service endpoints can run a Bash script. section 4.1.6

Probe mechanisms include:

  • HTTP: call an endpoint such as /healthz; HTTP 200 means success, while another response or a timeout means failure. section 4.1.6
  • TCP: attempt to open a connection, which suits TCP services such as SMTP. section 4.1.6
  • Bash script: execute custom tests for workloads such as batch jobs; a nonzero exit code means failure. section 4.1.6

TCP readiness configuration

A TCP-based service can use a readiness probe that waits 15 seconds before checking port 25, repeats every 30 seconds, and requires one successful check or one failure according to the configured thresholds. section 4.1.6

readinessProbe:
  initialDelaySeconds: 15
  periodSeconds: 30
  tcpSocket:            #1
    port: 25            #1
  successThreshold: 1
  failureThreshold: 1
#1 TCP probe specification

Inspect the probe configuration showing initial delay, checking interval, TCP port, and success and failure thresholds. section 4.1.6

How Kubernetes for Developers covers it

How deep it goes
Explains HTTP, TCP, and Bash-script implementations with success criteria and a readiness configuration, without broader probe lifecycle details.
Examples
Uses a /healthz endpoint, an SMTP TCP service, Bash checks for batch jobs, and a port 25 readiness configuration.
What it assumes
Assumes containerized workloads and distinguishes services with HTTP or TCP endpoints from batch jobs without service endpoints.
What you can do after
Operate/configure Kubernetes health checks using HTTP endpoints, TCP connections, or Bash scripts matched to the workload.
How it connects
Connects probes with Kubernetes, containers, health checks, HTTP services, TCP services, and batch jobs.

Also explained in

Compare how 2 books explain probe →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes for Developers. The section links point to the parts of the book it draws on.