Liveness vs. Readiness: Kubernetes Health Check Difference | DistantJob - Remote Recruitment Agency
Tech Insights

Liveness vs. Readiness: Kubernetes Health Check Difference

Cesar Fazio
- 3 min. to read

Liveness and Readiness Probes are what separate a basic deployment from a truly robust and reliable application. Do you know the secret to high availability and resilience in Kubernetes? It isn’t just about running containers, but probing what’s happening inside them. 

How can the orchestrator tell if your application is running correctly or ready to serve traffic? The answer lies in probes, the essential health check mechanism of Kubernetes.

Liveness probes check if an app is alive (needs a restart if it fails). Readiness probes check if the app is ready to serve traffic (receives and answers requests).

In this article, we’ll dive into the function of each one and see how to configure them in your YAML manifest.

1. Liveness Probe: Your Application’s Sentinel

The Liveness Probe is responsible for determining whether your container is alive. It ensures that if your application enters an unrecoverable failure state (like a deadlock or memory error), Kubernetes can intervene. If the Liveness Probe fails, the kubelet restarts the container.

When to use it?

Use the Liveness Probe to detect internal application failures that do not stop the application but render it unusable. For example, an Apache server that’s running but can’t process requests.

Configuration Example (Liveness with Command)

You can configure Liveness to execute a command inside the container. If the command returns exit code 0, the container is considered healthy. Any other value indicates failure. In this example, we are using a simple Apache web server in its latest version.

YAML

apiVersion: apps/v1
kind: Deployment
metadata:
  name: app-html-deployment
  labels:
    app: app-html
spec:
  replicas: 3
  selector:
    matchLabels:
      app: app-html
  template:
    metadata:
      labels:
        app: app-html
    spec:
      containers:
      - name: app-html
        image: httpd:latest
        ports:
        - containerPort: 80
        # --- PROBING SECTION STARTS HERE ---
        livenessProbe:
          httpGet:
            path: 
            port: 80
          initialDelaySeconds: 5 # Waits 5 seconds before first check
          periodSeconds: 10 # Checks it every 10 seconds
          failureThreshold: 3 # After three failures, restarts the container

2. Readiness Probe: The Intelligent Traffic Manager

The Readiness Probe is crucial for traffic management. It determines if the container is ready to accept requests. This prevents traffic from being routed to an application that has just started but is still loading data, warming up a cache, or connecting to an external database. If the Readiness Probe fails, Kubernetes removes the Pod from the Service’s endpoints. Traffic is not being sent to it until the probe succeeds again.

When to use it?

Use it to control when a Pod should start receiving traffic. This is especially important during rollouts to ensure new versions only serve requests when they are 100% operational.

Configuration Example (Readiness with HTTP)

The most common method is via HTTP, where Kubernetes makes requests to a specific endpoint. A status code between 200 and 399 is considered a success.

YAML

apiVersion: apps/v1
kind: Deployment
metadata:
  name: app-html-deployment
  labels:
    app: app-html
spec:
  replicas: 3
  selector:
    matchLabels:
      app: app-html
  template:
    metadata:
      labels:
        app: app-html
    spec:
      containers:
      - name: app-html
        image: httpd:latest
        ports:
        - containerPort: 80
        # --- PROBING SECTION STARTS HERE ---
        livenessProbe:
          httpGet:
            path: 
            port: 80
          initialDelaySeconds: 5 
          periodSeconds: 10  
          failureThreshold: 3  
        # --- READINESS PROBE IS ADDED HERE ---
        readinessProbe:
          httpGet:
            path: /
            port: 80
          initialDelaySeconds: 1 # Waits 1 second for the first check
          periodSeconds: 5 # Checks every 5 seconds
          successThreshold: 1 # A single success is enough
        # --- PROBES SECTION ENDS HERE ---

The difference between Kubernetes Readiness vs Liveness Probe

The separation between Liveness and Readiness probes often causes initial confusion, but their roles are fundamentally distinct and never interchangeable. The Liveness probe continuously checks whether the application is healthy and functional once it is up and running. In contrast, the Readiness probe manages external client experience and prevents service degradation.

They operate as two complementary mechanisms focused on different aspects of availability. The following table summarizes the core purpose and resulting action of each probe, which are the most important distinctions.

FeatureLiveness Probe (livenessProbe)Readiness Probe (readinessProbe)
Primary GoalContainer Health/AlivenessApplication Availability/Serviceability
Probe Question“Is this application still running and able to make progress?” (i.e., not deadlocked)“Is this application ready to handle incoming network traffic?”
Action on FailureRestarts the container. The Kubelet kills the container, and the pod’s restartPolicy takes effect (usually restarting the container).Stops sending traffic. The Pod’s IP address is removed from the associated Kubernetes Service Endpoints.
Impact on TrafficNone, initially. If it fails and the container is restarted, the pod temporarily loses traffic while restarting.Immediately halts the flow of new requests to the pod.
Typical Use CaseDetecting terminal failure or deadlocks (app is running but unresponsive). E.g., a process running out of memory and getting stuck.Detecting temporary unavailability. E.g., when the application is starting up, loading large files, warming caches, or temporarily losing a required database connection.
Restart/RemovalRestarts the container to self-heal.Removes the pod from service rotation to prevent client errors.
Configuration PathDefined under spec.containers[].livenessProbeDefined under spec.containers[].readinessProbe
Best Practice EndpointCheck internal state only (e.g., is the web server process running?). Should not depend on external services (like databases).Check external dependencies and internal readiness (e.g., is the database reachable? Has the cache been populated?).

It is highly recommended to use both probes for most applications:

  1. Liveness keeps the container healthy by forcing a restart when it’s critically broken.
  2. Readiness ensures zero-downtime traffic management by pulling the container out of rotation when it’s temporarily unable to serve requests, preventing end-user errors.

Conclusion

Probes are not a luxury; they are a fundamental requirement for reliably operating workloads in Kubernetes.

  • Use the Liveness Probe to restart containers in a deadlock.
  • Use the Readiness Probe to control containers ready for traffic.

By combining them intelligently, you ensure that your users always interact with healthy and operational instances, maximizing the stability of your environment.

Need help implementing these practices at scale? Work with DevOps engineers who specialize in building production-grade Kubernetes environments.

Cesar Fazio

César is a digital marketing strategist and business growth consultant with experience in copywriting. Self-taught and passionate about continuous learning, César works at the intersection of technology, business, and strategic communication. In recent years, he has expanded his expertise to product management and Python, incorporating software development and Scrum best practices into his repertoire. This combination of business acumen and technical prowess allows structured scalable digital products aligned with real market needs. Currently, he collaborates with DistantJob, providing insights on marketing, branding, and digital transformation, always with a pragmatic, ethical, and results-oriented approach—far from vanity metrics and focused on measurable performance.

Learn how to hire offshore people who outperform local hires

What if you could approach companies similar to yours, interview their top performers, and hire them for 50% of a North American salary?

Subscribe to our newsletter and get exclusive content and bloopers

or Share this post

Learn how to hire offshore people who outperform local hires

What if you could approach companies similar to yours, interview their top performers, and hire them for 50% of a North American salary?

Reduce Development Workload And Time With The Right Developer

When you partner with DistantJob for your next hire, you get the highest quality developers who will deliver expert work on time. We headhunt developers globally; that means you can expect candidates within two weeks or less and at a great value.

Increase your development output within the next 30 days without sacrificing quality.

Book a Discovery Call

What are your looking for?
+

Want to meet your top matching candidate?

Find professionals who connect with your mission and company.

    pop-up-img
    +

    Talk with a senior recruiter.

    Fill the empty positions in your org chart in under a month.