#!/bin/bash # Quick Kubernetes cluster status check # Returns structured output for easy parsing set -euo pipefail echo "=== Node Status ===" kubectl get nodes -o wide 2>/dev/null || echo "Error: Cannot reach cluster" echo "" echo "=== Unhealthy Pods ===" kubectl get pods -A --field-selector=status.phase!=Running,status.phase!=Succeeded 2>/dev/null | grep -v "^NAMESPACE" || echo "All pods healthy" echo "" echo "=== High Restart Pods ===" kubectl get pods -A -o jsonpath='{range .items[?(@.status.containerStatuses[0].restartCount>5)]}{.metadata.namespace}/{.metadata.name}: {.status.containerStatuses[0].restartCount} restarts{"\n"}{end}' 2>/dev/null || echo "No high restart pods" echo "" echo "=== Recent Warning Events ===" kubectl get events -A --field-selector=type=Warning --sort-by='.lastTimestamp' 2>/dev/null | tail -10 || echo "No warning events" echo "" echo "=== ArgoCD Apps ===" if command -v argocd &>/dev/null; then argocd app list --output wide 2>/dev/null || echo "ArgoCD not accessible" else echo "ArgoCD CLI not installed" fi