HTTP probe configuration in Kubernetes - Time & Space Complexity
When Kubernetes checks if an app is healthy using HTTP probes, it sends requests repeatedly.
We want to understand how the number of these checks grows as the app or cluster size changes.
Analyze the time complexity of the following HTTP readiness probe configuration.
readinessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
failureThreshold: 3
This config tells Kubernetes to send an HTTP GET request to /healthz on port 8080 every 10 seconds after waiting 5 seconds initially, and to consider the pod unhealthy after 3 failures.
Identify the loops, recursion, array traversals that repeat.
- Primary operation: Kubernetes sends HTTP GET requests repeatedly to check pod health.
- How many times: Every 10 seconds indefinitely until pod stops or fails.
Explain the growth pattern intuitively.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 pods | 10 probes every 10 seconds |
| 100 pods | 100 probes every 10 seconds |
| 1000 pods | 1000 probes every 10 seconds |
Pattern observation: The number of HTTP probe requests grows linearly with the number of pods.
Time Complexity: O(n)
This means the total number of health check requests grows directly in proportion to the number of pods.
[X] Wrong: "The probe runs only once per pod, so it doesn't add up much."
[OK] Correct: The probe runs repeatedly at fixed intervals, so the total checks increase as pods increase and time passes.
Understanding how repeated health checks scale helps you design efficient monitoring in real systems.
"What if the periodSeconds is halved? How would the time complexity change?"