HTTP Probe Configuration
You'll learn how to configure HTTP-based health checks to monitor container health via web endpoints.
What is HTTP Probe Configuration?
When your container runs a web service, Kubernetes can check its health by sending HTTP requests to specific endpoints. HTTP probes let you define exactly where to send requests, what to expect back, and how to interpret success or failure. This is one of the most common probe types for microservices and web applications.
Core Configuration Elements
An HTTP probe requires several key parameters:
Path: The URL path Kubernetes requests (e.g., /health, /ready, /api/status)
Port: Which container port to check (can be a number or named port)
HTTP Headers: Optional custom headers to include in the request (useful for authentication or routing)
Success Criteria: What response codes indicate success (default: 200-399)
Think of It This Way
Imagine a security guard checking if a restaurant is open. Instead of just knocking on the door, they:
- Go to a specific entrance (
path) - Check a particular door number (
port) - Show their badge if required (
headers) - Determine "open" based on whether someone answers properly (
success criteria)
Example Structure
livenessProbe:
httpGet:
path: /healthz
port: 8080
httpHeaders:
- name: Custom-Header
value: HealthCheck
initialDelaySeconds: 15
periodSeconds: 10
This configuration tells Kubernetes: "Every 10 seconds, send an HTTP GET to /healthz on port 8080 with a custom header. If you get back a 2xx or 3xx status, the container is alive."
Key Takeaway: HTTP probes give you fine-grained control over health checks by specifying endpoints, ports, headers, and success conditions—perfect for API-driven applications.