You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# 1. Collect all pod information with labels and annotations
46
+
echo"===== POD OVERVIEW WITH LABELS =====">>"$OUTPUT_FILE"
47
+
kubectl get pods -n "${NAMESPACE}" -o wide --show-labels >>"$OUTPUT_FILE"2>&1||echo"Failed to get pod overview">>"$OUTPUT_FILE"
48
+
echo"">>"$OUTPUT_FILE"
49
+
50
+
# 2. Collect Argo Workflow information
51
+
echo"===== ARGO WORKFLOWS =====">>"$OUTPUT_FILE"
52
+
kubectl get workflows -n "${NAMESPACE}" -o wide --show-labels >>"$OUTPUT_FILE"2>&1||echo"No workflows found or failed to get workflows">>"$OUTPUT_FILE"
53
+
echo"">>"$OUTPUT_FILE"
54
+
55
+
# 3. Collect recent events (last 30 minutes)
56
+
echo"===== RECENT EVENTS =====">>"$OUTPUT_FILE"
57
+
kubectl get events -n "${NAMESPACE}" --sort-by='.lastTimestamp'>>"$OUTPUT_FILE"2>&1||echo"Failed to get events">>"$OUTPUT_FILE"
58
+
echo"">>"$OUTPUT_FILE"
59
+
60
+
# 4. Filter pods created after test start time (if provided)
61
+
local POD_NAMES
62
+
if [[ -n"$START_TIME" ]];then
63
+
echo"===== PODS CREATED DURING TEST (after $START_TIME) =====">>"$OUTPUT_FILE"
echo"No pods found created after $START_TIME">>"$OUTPUT_FILE"
69
+
# Fall back to all pods
70
+
POD_NAMES=$(kubectl get pods -n "${NAMESPACE}" -o custom-columns=":metadata.name" --no-headers)
71
+
fi
72
+
else
73
+
POD_NAMES=$(kubectl get pods -n "${NAMESPACE}" -o custom-columns=":metadata.name" --no-headers)
74
+
fi
75
+
echo"">>"$OUTPUT_FILE"
76
+
77
+
if [[ -z"${POD_NAMES}" ]];then
78
+
echo"No pods found in namespace '${NAMESPACE}'.">>"$OUTPUT_FILE"
79
+
return
80
+
fi
81
+
82
+
# 5. Detailed pod information with logs
83
+
forPOD_NAMEin${POD_NAMES};do
84
+
{
85
+
echo"=========================================="
86
+
echo"POD: ${POD_NAME}"
87
+
echo"=========================================="
88
+
89
+
echo"----- POD METADATA -----"
90
+
kubectl get pod "${POD_NAME}" -n "${NAMESPACE}" -o yaml | grep -E "(name:|namespace:|labels:|annotations:|creationTimestamp:|phase:|conditions:)"||echo"Failed to get pod metadata"
91
+
92
+
echo""
93
+
echo"----- POD DESCRIPTION -----"
94
+
kubectl describe pod "${POD_NAME}" -n "${NAMESPACE}"||echo"Failed to describe pod ${POD_NAME}"
95
+
96
+
echo""
97
+
echo"----- POD LOGS (last 1000 lines) -----"
98
+
kubectl logs "${POD_NAME}" -n "${NAMESPACE}" --tail=1000 ||echo"No logs found for pod ${POD_NAME}"
99
+
100
+
# Check for multiple containers
101
+
local CONTAINERS
102
+
CONTAINERS=$(kubectl get pod "${POD_NAME}" -n "${NAMESPACE}" -o jsonpath='{.spec.containers[*].name}'2>/dev/null)
0 commit comments