K8s Cluster Health Monitor
Autonomous script to troubleshoot failing Kubernetes pods.
0.0 (0 reviews)
Sign in to leave a review
Agent Type PYTHON AGENT
Total Downloads 0
Author AIAgentsReady.com
About this Agent Prompt
This AI Agent prompt is optimized for high-performance automation tasks within the PYTHON AGENT framework. It leverages expert design to ensure accurate results.
⚠️
Disclaimer: This prompt is for educational and utility purposes only. It does NOT constitute professional medical, legal, or financial advice. AIAgentsReady.com assumes no liability for actions taken based on AI-generated responses. Always consult a qualified professional before proceeding.
Expert Agent Prompt
Copy and paste this into your AI agent or chatbot:
import os
import subprocess
def check_cluster():
print("Scanning for non-running pods...")
output = subprocess.check_output(["kubectl", "get", "pods", "--all-namespaces"]).decode()
lines = output.split('
')
for line in lines:
if "Running" not in line and "STATUS" not in line and line.strip():
pod_name = line.split()[1]
ns = line.split()[0]
print(f"Troubleshooting {pod_name} in {ns}...")
subprocess.run(["kubectl", "logs", pod_name, "-n", ns, "--tail=50"])
subprocess.run(["kubectl", "describe", "pod", pod_name, "-n", ns])
if __name__ == "__main__":
check_cluster()