0
0
Kubernetesdevops~5 mins

HTTP probe configuration in Kubernetes - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: HTTP probe configuration
O(n)
Understanding Time 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.

Scenario Under Consideration

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 Repeating Operations

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.
How Execution Grows With Input

Explain the growth pattern intuitively.

Input Size (n)Approx. Operations
10 pods10 probes every 10 seconds
100 pods100 probes every 10 seconds
1000 pods1000 probes every 10 seconds

Pattern observation: The number of HTTP probe requests grows linearly with the number of pods.

Final Time Complexity

Time Complexity: O(n)

This means the total number of health check requests grows directly in proportion to the number of pods.

Common Mistake

[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.

Interview Connect

Understanding how repeated health checks scale helps you design efficient monitoring in real systems.

Self-Check

"What if the periodSeconds is halved? How would the time complexity change?"