Listen to this Post

Kubernetes health checks and probes are essential for ensuring your containers are running as expected. They help detect failures, restart unhealthy containers, and maintain high availability. The key probes include:
- Liveness Probes: Determine if a container is running. If it fails, Kubernetes restarts the container.
- Readiness Probes: Check if a container is ready to serve traffic. If not, itβs removed from service until healthy.
- Startup Probes: Delay other probes until the app completes startup.
Example YAML configuration:
apiVersion: v1 kind: Pod metadata: name: health-check-demo spec: containers: - name: app-container image: nginx livenessProbe: httpGet: path: /health port: 8080 initialDelaySeconds: 5 periodSeconds: 10 readinessProbe: httpGet: path: /ready port: 8080 initialDelaySeconds: 2 periodSeconds: 5 startupProbe: httpGet: path: /startup port: 8080 failureThreshold: 30 periodSeconds: 10
You Should Know:
1. Implementing Health Checks in Your App
For a Node.js app, add a `/health` endpoint:
const express = require('express');
const app = express();
app.get('/health', (req, res) => {
res.status(200).send('OK');
});
app.listen(8080, () => {
console.log('App running on port 8080');
});
2. Debugging Probe Failures
Use these commands to troubleshoot:
kubectl describe pod <pod-name> Check probe failures kubectl logs <pod-name> View container logs kubectl exec -it <pod-name> -- curl http://localhost:8080/health Manual check
3. Advanced Probe Configurations
- TCP Socket Probe:
livenessProbe: tcpSocket: port: 8080 initialDelaySeconds: 15 periodSeconds: 20
-
Command Probe:
livenessProbe: exec: command:</p></li> <li>cat</li> <li>/tmp/healthy
4. Automating Recovery with Kubernetes
Set `restartPolicy: Always` in your Pod spec to ensure containers restart automatically.
What Undercode Say:
Kubernetes probes are critical for resilient deployments. Always:
- Test probes locally before deploying.
- Monitor logs for false positives/negatives.
- Use `kubectl get events` to track pod lifecycle events.
Additional Linux/IT commands for debugging:
netstat -tuln | grep 8080 Check if port is open systemctl status kubelet Ensure Kubelet is running journalctl -u kubelet -f View Kubelet logs kubectl top pods Check resource usage
For Windows-based Kubernetes nodes:
Get-EventLog -LogName Application -Source Docker | Select-Object -First 10 Docker logs kubectl get nodes -o wide Check node status
Expected Output:
A well-configured Kubernetes cluster with automated health checks, ensuring minimal downtime and quick recovery from failures.
Prediction:
As Kubernetes adoption grows, AI-driven auto-tuning of probe thresholds (e.g., adjusting `periodSeconds` based on traffic) will become standard.
Reference:
Kubernetes Health Checks and Probes: What You Need to Know
IT/Security Reporter URL:
Reported By: Darryl Ruggles – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass β


