blog
  • Blogs
    • Medium Articles
      • Linux
        • 40 Powerful Linux Networking Commands You Must Know.
        • These (Linux) VI Editor Shortcuts You Must Know
        • Bash/Linux Interview Questions for DevOps Engineers
        • Page 1
      • Git
        • 40 Powerful Git Commands Every Developer Should Know
        • 10 Git Best Practices That Every Developer Must Know
      • DevOps/SRE Interview Questions and Answers
        • Top DevOps/SRE Interview Questions and Answers on AWS VPC
        • Top 10 Common DevOps/SRE Interview Questions and Answers on Terraform Best Practices
        • Top 10 Common DevOps/SRE Interview Questions and Answers on Kubernetes Best Practices
        • Top 10 Common DevOps/SRE Interview Questions and Answers on Dockerfiles
        • Top 10 Common DevOps/SRE Interview Questions and Answers on Grafana
      • Installation
        • Docker Installation on Ubuntu 20/22
        • Install WireGuard VPN on Docker Compose
        • Install Redis on Docker Compose
        • Gravitee Docker Compose
      • Kubernetes Series 2025
        • Understanding Kubernetes: Part 1 -Control Plane
        • Understanding Kubernetes: Part 2 -Worker Node
        • Understanding Kubernetes: Part 3 -Pod
        • Understanding Kubernetes: Part 4-ReplicaSets
        • Understanding Kubernetes: Part 5 -Deployment
        • Understanding Kubernetes: Part 6 -DaemonSets
        • Understanding Kubernetes: Part 7 -StatefulSet
        • Understanding Kubernetes: Part 8 -ConfigMap
        • Understanding Kubernetes: Part 9 -Kubernetes Secret
        • Understanding Kubernetes: Part 10 -StorageClass
        • Understanding Kubernetes: Part 11 -Persistent Volume (PV)
        • Understanding Kubernetes: Part 12 -Persistent Volume Claim (PVC)
        • Understanding Kubernetes: Part 13 -Services
        • Understanding Kubernetes: Part 14 -ClusterIP Service
        • Understanding Kubernetes: Part 15 -NodePort Service
        • Understanding Kubernetes: Part 16 -Load Balancer Service
        • Understanding Kubernetes: Part 17 -Ingress
        • Understanding Kubernetes: Part 18 -Ingress Controller
        • Understanding Kubernetes: Part 19 -Headless Service
        • Understanding Kubernetes: Part 20-Network Policy
        • Understanding Kubernetes: Part 21 -CNI
        • Understanding Kubernetes: Part 22 Kubernetes Resource Requests & Limits
        • Understanding Kubernetes: Part 23 Node Selector
        • Understanding Kubernetes: Part 24 Taints and Tolerations
        • Understanding Kubernetes: Part 25 Affinity and Anti-Affinity
        • Understanding Kubernetes: Part 26 Preemption and Priority
        • Understanding Kubernetes: Part 27 Role and RoleBinding
        • Understanding Kubernetes: Part 28 ClusterRole and ClusterRoleBinding
        • Understanding Kubernetes: Part 29 Service Account
        • Understanding Kubernetes: Part 30 Horizontal Pod Autoscaler (HPA)
        • Understanding Kubernetes: Part 31 Vertical Pod Autoscaler (VPA)
        • Understanding Kubernetes: Part 33 Startup Probe
        • Understanding Kubernetes: Part 34 Liveness Probe
        • Understanding Kubernetes: Part 35 Readiness Probe
        • Understanding Kubernetes: Part 36 Container Network Interface (CNI)
        • Understanding Kubernetes: Part 37 Container Runtime Interface (CRI)
        • Understanding Kubernetes: Part 38 Container Storage Interface (CSI)
      • Cloudflare
        • Cloudflare Tunnel for Secure HTTP Routing
      • Nginx
        • Nginx use cases that every engineer must know
Powered by GitBook
On this page
  1. Blogs
  2. Medium Articles
  3. Kubernetes Series 2025

Understanding Kubernetes: Part 35 Readiness Probe

PreviousUnderstanding Kubernetes: Part 34 Liveness ProbeNextUnderstanding Kubernetes: Part 36 Container Network Interface (CNI)

Last updated 3 months ago

📢 If you’ve been following our Kubernetes series 2025, welcome back! For new readers, check out Liveness Probe

What is a Readiness Probe in Kubernetes?

A Readiness Probe in Kubernetes is a diagnostic tool used to determine if a pod is ready to serve traffic. Unlike the Liveness Probe, which checks if a pod is still running, the readiness probe checks whether the pod is ready to accept requests. If the readiness probe fails, the pod is considered not ready, and Kubernetes will stop sending traffic to it. However, the pod will not be restarted (unlike in the case of a liveness probe failure).

For example:

Consider a web application pod that takes some time to initialize after being started (e.g., loading configurations, establishing database connections, etc.). You don’t want Kubernetes to send traffic to the pod until it is fully initialized. In such a scenario, you can use a readiness probe to ensure the pod only starts receiving traffic once it’s ready to handle requests.

Readiness Probe Capabilities:

  • Types of Checks: Like the liveness probe, readiness probes can use HTTP requests, TCP socket connections, or execute commands to check the pod’s readiness.

  • HTTP Check: Sends an HTTP request to a specified path and expects a successful response (e.g., 200 OK).

  • TCP Check: Tries to establish a TCP connection on a specified port.

  • Exec Check: Executes a command inside the container. If the command succeeds (exit code 0), the pod is considered ready.

  • Failure Thresholds: You can configure how many consecutive failures must occur before Kubernetes considers the pod not ready.

  • Customizability: The readiness probe can be configured with parameters such as initialDelaySeconds, periodSeconds, timeoutSeconds, successThreshold, and failureThreshold.

In my previous role:

As a Senior DevOps Engineer, I used readiness probes to manage the traffic routing for services that had complex initialization processes. For example, I configured a web application to check the availability of its database before accepting any traffic. If the readiness probe failed, Kubernetes would ensure that no requests were routed to the pod until the database was accessible. This helped ensure that users never experienced failed requests due to the application being in an unready state.

Here’s a simple YAML for a Readiness Probe:

HTTP Readiness Probe:

apiVersion: v1
kind: Pod
metadata:
  name: web-app
spec:
  containers:
    - name: web-container
      image: web-app:latest
      readinessProbe:
        httpGet:
          path: /readiness
          port: 8080
        initialDelaySeconds: 10
        periodSeconds: 5
        timeoutSeconds: 2
        failureThreshold: 3

In this example:

  • The readinessProbe sends an HTTP GET request to the /readiness endpoint on port 8080 of the web-container.

  • The probe will start checking after a delay of 10 seconds (initialDelaySeconds), then continue every 5 seconds (periodSeconds).

  • If the probe takes longer than 2 seconds to respond, it will fail (timeoutSeconds).

  • If the probe fails 3 consecutive times (failureThreshold), the pod will be marked as not ready and will stop receiving traffic.

TCP Readiness Probe:

apiVersion: v1
kind: Pod
metadata:
  name: database
spec:
  containers:
    - name: db-container
      image: db-image:latest
      readinessProbe:
        tcpSocket:
          port: 3306
        initialDelaySeconds: 5
        periodSeconds: 10

In this example:

  • The readinessProbe attempts to establish a TCP connection on port 3306 to check if the database service is ready.

  • The probe checks every 10 seconds, starting after an initial delay of 5 seconds.

Readiness probes are critical for ensuring that Kubernetes only sends traffic to pods that are ready to handle it. They help avoid service disruptions by preventing traffic from reaching pods that are still initializing or in a non-ready state.

🚀 Ready to Master Kubernetes?

Take your Kubernetes journey to the next level with the Master Kubernetes: Zero to Hero course! 🌟 Whether you’re a beginner or aiming to sharpen your skills, this hands-on course covers:

✅ Kubernetes Basics — Grasp essential concepts like nodes, pods, and services. ✅ Advanced Scaling — Learn HPA, VPA, and resource optimization. ✅ Monitoring Tools — Master Prometheus, Grafana, and AlertManager. ✅ Real-World Scenarios — Build production-ready Kubernetes setups.

🔥 Flash Sale: Buy Kubernetes Course, Get Terraform FREE! Limited Time Offer!

Don’t miss your chance to become a Kubernetes expert! 💻✨

🚀 Master Terraform: Infrastructure as Code

Apply Code DEVOPS20 for 20% OFF!

🔥 Start Learning Now: [Join the Master Kubernetes Course + FREE Access to Terraform Course]()

🚀 Stay ahead in DevOps and SRE! 🔔 and never miss a beat on Kubernetes and more. 🌟

🔥 Start Learning Now:

https://cloudops0.gumroad.com/l/k8s
Subscribe now
Join the Master Terraform Course
Part 34
READINESS PROBE