A health check automatically assesses whether a running microservice is available and functioning according to operational criteria. In production, it supports continuous monitoring and helps detect problems after deployment and during updates. section 11.2 section 11.6
Kubernetes separates two useful questions:
- A readiness probe reports that a microservice has started and can accept requests. section 11.2.8
- A liveness probe reports that a microservice remains alive and continues accepting requests. section 11.2.8
- Kubernetes can use these results to identify unhealthy workloads and restart misbehaving pods. section 11.2.8 section 11.6
Gateway probes
A Deployment can configure the gateway with an HTTP readiness probe at /ready and an HTTP liveness probe at /alive. The readiness check waits five seconds before beginning its queries, while both probes target the container's configured port. section 11.2.8
Listing 11.1 Adding Kubernetes probes for the gateway microservice
apiVersion: apps/v1
kind: Deployment
metadata:
name: gateway
spec:
replicas: 1
selector:
matchLabels:
app: gateway
template:
metadata:
labels:
app: gateway
spec:
containers:
- name: gateway
image: $CONTAINER_REGISTRY/gateway:$VERSION
imagePullPolicy: IfNotPresent
readinessProbe: #1
httpGet:
path: /ready #2
port: {{PORT}}
initialDelaySeconds: 5 #1
livenessProbe: #3
httpGet:
path: /alive #4
port: {{PORT}} #3
env:
- name: PORT
value: "4000"
- name: RABBIT
value: amqp://test:test@rabbit:5672
Inspect the complete Kubernetes Deployment manifest for configuring readiness and liveness probes on the gateway microservice. section 11.2.8
Health checks also handle dependency timing. A microservice can remain unavailable until an upstream service such as RabbitMQ is ready, avoiding premature connection failures during startup, restart, or maintenance. section 11.2.8








