0
0
Kubernetesdevops~3 mins

Why Exec probe configuration in Kubernetes? - Purpose & Use Cases

Choose your learning style9 modes available
The Big Idea

What if your app could tell you when it's sick, all by itself?

The Scenario

Imagine you have a web app running in a container, and you want to check if it's healthy by manually logging into the container and running commands to see if it works.

The Problem

This manual checking is slow, needs you to connect every time, and you might miss problems if you don't check often. It's easy to forget or make mistakes, causing downtime.

The Solution

Exec probe configuration lets Kubernetes automatically run a command inside your container regularly to check if it is healthy. This way, the system knows when to restart or fix the app without you lifting a finger.

Before vs After
Before
kubectl exec -it mypod -- curl http://localhost:8080/health
After
livenessProbe:
  exec:
    command:
    - curl
    - -f
    - http://localhost:8080/health
  initialDelaySeconds: 10
  periodSeconds: 5
What It Enables

It enables automatic, reliable health checks inside containers, so your apps stay running smoothly without manual intervention.

Real Life Example

A shopping website uses exec probes to check if its payment service is working. If the check fails, Kubernetes restarts the service instantly, avoiding lost sales.

Key Takeaways

Manual health checks are slow and error-prone.

Exec probes automate health checks by running commands inside containers.

This keeps apps healthy and reduces downtime automatically.