liveBook · Manning

Http get probe

As explained in Kubernetes in Action, Second Edition

An httpGet probe is a Kubernetes container probe that sends an HTTP GET request to determine the application state.

An HTTP GET probe checks an application by sending a GET request to a container’s IP address, port, and path. A 2xx or 3xx response succeeds; an error response, timeout, or missing response fails. As a liveness probe, repeated failures can cause Kubernetes to terminate and restart the container when its restart policy allows. section 6.2.2

Configure the probe around the application endpoint and the lifecycle decision it supports:

  • Use a simple path such as / on the application port when the application has no dedicated health endpoint. section 6.2.3
  • Use a dedicated endpoint such as /ready on an administration port when a proxy exposes explicit health status; ports may be numeric or named. section 6.2.3
  • Tune initialDelaySeconds, periodSeconds, timeoutSeconds, and failureThreshold to control when checks begin, how often they run, their timeout, and required consecutive failures. section 6.2.3
  • Keep handlers lightweight and avoid retry loops; let failureThreshold provide repeated-failure tolerance. section 6.2.7
  • Apply the same HTTP mechanism to readiness when the response should determine whether a service forwards connections to the pod. section 11.6.1

A liveness probe in a Pod manifest

A container serving HTTP on port 8080 can define httpGet with path / and port 8080. A proxy can instead check /ready on its named admin port, with a 10-second initial delay, 5-second period, 2-second timeout, and three-failure threshold. section 6.2.3

Listing 6.1 Adding a liveness probe to a pod
apiVersion: v1
kind: Pod
metadata:
  name: kiada-liveness
spec:
  containers:
  - name: kiada
    image: luksa/kiada:0.1
    ports:
    - name: http
      containerPort: 8080
    livenessProbe:           #1
      httpGet:               #1
        path: /              #1
        port: 8080           #1
  - name: envoy
    image: luksa/kiada-ssl-proxy:0.1
    ports:
    - name: https
      containerPort: 8443
    - name: admin
      containerPort: 9901
    livenessProbe:                #2
      httpGet:                    #2
        path: /ready              #2
        port: admin               #2
      initialDelaySeconds: 10     #2
      periodSeconds: 5            #2
      timeoutSeconds: 2           #2
      failureThreshold: 3         #2

Inspect the complete Pod manifest showing minimal and fully configured HTTP GET liveness probes. section 6.2.3

How Kubernetes in Action, Second Edition covers it

How deep it goes
Explains request semantics, response codes, endpoints, timing fields, defaults, and lifecycle effects without descending into probe implementation internals.
Examples
Demonstrates root and /ready endpoints, numeric and named ports, and a complete Pod manifest with timing thresholds.
What it assumes
Assumes an application exposes an HTTP endpoint and distinguishes liveness from readiness through their lifecycle effects.
What you can do after
Operate/configure it by defining HTTP endpoints, ports, timing values, and failure thresholds in a Pod manifest.
How it connects
Connects HTTP GET probes with liveness probes, readiness probes, startup probes, containers, pods, and services.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.