0
0
Kubernetesdevops~30 mins

Exec probe configuration in Kubernetes - Mini Project: Build & Apply

Choose your learning style9 modes available
Exec Probe Configuration in Kubernetes
📖 Scenario: You are managing a Kubernetes deployment for a simple web application. You want to ensure the application container is healthy by running a command inside the container periodically. This helps Kubernetes know if the container is working properly and restart it if needed.
🎯 Goal: Configure an exec liveness probe in a Kubernetes Pod manifest that runs a command inside the container to check its health.
📋 What You'll Learn
Create a Pod manifest with a container named webapp
Add an exec liveness probe that runs the command ['cat', '/tmp/healthy']
Set the probe to run every 5 seconds
Print the final Pod manifest YAML
💡 Why This Matters
🌍 Real World
Exec probes are used in Kubernetes to check container health by running commands inside containers. This helps keep applications running smoothly by restarting unhealthy containers automatically.
💼 Career
Understanding exec probes is essential for Kubernetes administrators and DevOps engineers to maintain reliable containerized applications.
Progress0 / 4 steps
1
Create the basic Pod manifest
Create a Kubernetes Pod manifest named pod.yaml with a single container named webapp using the image busybox. The container should run the command ['sleep', '3600'] to keep it alive.
Kubernetes
Need a hint?

Use apiVersion: v1, kind: Pod, and define containers with the specified name, image, and command.

2
Add the exec liveness probe configuration
Add a livenessProbe section to the webapp container. Configure it to use an exec command that runs ['cat', '/tmp/healthy'].
Kubernetes
Need a hint?

Under livenessProbe, use exec with a command list containing cat and /tmp/healthy.

3
Set the probe interval
Add the periodSeconds field to the livenessProbe and set it to 5 so the probe runs every 5 seconds.
Kubernetes
Need a hint?

Add periodSeconds: 5 under livenessProbe to set the probe interval.

4
Print the final Pod manifest
Print the complete Pod manifest YAML to verify your configuration.
Kubernetes
Need a hint?

Use a print statement to output the full YAML manifest exactly as configured.