add network debug in cicd.yaml

This commit is contained in:
s871077
2026-09-16 16:08:30 +08:00
parent c38b41c6fd
commit 067a627959
2 changed files with 68 additions and 0 deletions
+67
View File
@@ -72,6 +72,73 @@ jobs:
echo "${{ secrets.KUBE_CONFIG_DATA }}" | base64 -d > "${RUNNER_TEMP}/kubeconfig"
chmod 600 "${RUNNER_TEMP}/kubeconfig"
# Temporary debug step: we cannot shell into this self-hosted runner
# directly, so this proves (or disproves) network reachability to the
# k8s API from inside the runner itself, ahead of the image build/push
# so we fail fast instead of waiting ~10 min for the helm timeout.
# Remove once the ACL/connectivity issue is confirmed fixed.
- name: "[DEBUG] Network path to k8s API (6443)"
run: |
set +e
echo "===== Runner identity / network info ====="
hostname -f 2>/dev/null || hostname
echo "--- Interfaces ---"
ip -brief addr show 2>/dev/null || ifconfig
echo "--- Default route ---"
ip route show 2>/dev/null || route -n
echo
echo "===== K8s API endpoint (parsed from kubeconfig) ====="
KUBE_HOST=$(grep -m1 'server:' "${KUBECONFIG}" | sed -E 's#.*https?://([^:/]+).*#\1#')
KUBE_PORT=$(grep -m1 'server:' "${KUBECONFIG}" | sed -E 's#.*:([0-9]+)/?.*#\1#')
KUBE_PORT="${KUBE_PORT:-6443}"
echo "Host: ${KUBE_HOST}"
echo "Port: ${KUBE_PORT}"
echo
echo "===== DNS resolution ====="
getent hosts "${KUBE_HOST}" || nslookup "${KUBE_HOST}" || dig +short "${KUBE_HOST}"
RESOLVED_IPS=$(getent hosts "${KUBE_HOST}" | awk '{print $1}')
echo
echo "===== Route to each resolved IP ====="
for ip in ${RESOLVED_IPS}; do
echo "-- ip route get ${ip} --"
ip route get "${ip}" 2>/dev/null || echo "(ip route not available)"
done
echo
echo "===== TCP connect test per resolved IP (port ${KUBE_PORT}) ====="
for ip in ${RESOLVED_IPS}; do
if timeout 5 bash -c "cat < /dev/null > /dev/tcp/${ip}/${KUBE_PORT}" 2>/dev/null; then
echo "OK ${ip}:${KUBE_PORT} - TCP connect succeeded"
else
echo "FAIL ${ip}:${KUBE_PORT} - TCP connect timed out or refused"
fi
done
echo
echo "===== TCP connect test via hostname (through NLB, port ${KUBE_PORT}) ====="
if timeout 5 bash -c "cat < /dev/null > /dev/tcp/${KUBE_HOST}/${KUBE_PORT}" 2>/dev/null; then
echo "OK ${KUBE_HOST}:${KUBE_PORT} - TCP connect succeeded"
else
echo "FAIL ${KUBE_HOST}:${KUBE_PORT} - TCP connect timed out or refused"
fi
echo
echo "===== curl -v (expect HTTP 401/403 = reachable; a hang/timeout = blocked) ====="
curl -v -k --max-time 8 "https://${KUBE_HOST}:${KUBE_PORT}/version"
echo
echo "===== traceroute (best effort, may be blocked itself) ====="
if command -v traceroute >/dev/null 2>&1; then
traceroute -T -p "${KUBE_PORT}" -w 2 -m 15 "${KUBE_HOST}" || true
else
echo "traceroute not installed on runner, skipping"
fi
set -e
- name: Login to JFrog
run: |
# JFROG_REGISTRY is host/repo but `docker login` takes only the host.