71 lines
2.4 KiB
Bash
Executable File
71 lines
2.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Diagnostic script to debug NodePort networking issues
|
|
# This helps identify why some URLs work and others don't
|
|
|
|
echo "🔍 NodePort Networking Diagnostics"
|
|
echo "=================================="
|
|
echo ""
|
|
|
|
# Check pod locations
|
|
echo "📍 Current Pod Locations:"
|
|
kubectl get pods -l app=nginx-nodeport -o wide
|
|
echo ""
|
|
|
|
# Check node information
|
|
echo "🌐 Node Information:"
|
|
kubectl get nodes -o wide
|
|
echo ""
|
|
|
|
# Check service status
|
|
echo "🔧 Service Status:"
|
|
kubectl get svc nginx-nodeport-service
|
|
echo ""
|
|
|
|
# Test connectivity to each node
|
|
echo "🧪 Connectivity Tests:"
|
|
echo ""
|
|
|
|
PODS=$(kubectl get pods -l app=nginx-nodeport -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.nodeName}{"\n"}{end}')
|
|
|
|
while IFS=$'\t' read -r pod_name node_name; do
|
|
echo "Testing pod: $pod_name on node: $node_name"
|
|
|
|
# Get IPv6 for this specific node
|
|
IPV6=$(kubectl get node "$node_name" -o jsonpath='{range .status.addresses[?(@.type=="InternalIP")]}{.address}{"\n"}{end}' | grep -E '^[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+$' | head -1)
|
|
|
|
if [ ! -z "$IPV6" ]; then
|
|
echo " Node IPv6: $IPV6"
|
|
echo " Testing connectivity: curl -6 --connect-timeout 5 http://[$IPV6]:30091/health"
|
|
|
|
# Test HTTP connectivity
|
|
if curl -6 --connect-timeout 5 -s "http://[$IPV6]:30091/health" >/dev/null 2>&1; then
|
|
echo " ✅ HTTP connectivity: WORKING"
|
|
else
|
|
echo " ❌ HTTP connectivity: FAILED"
|
|
fi
|
|
|
|
# Test ICMP connectivity
|
|
echo " Testing ping: ping -6 -c 2 -W 3 $IPV6"
|
|
if ping -6 -c 2 -W 3 "$IPV6" >/dev/null 2>&1; then
|
|
echo " ✅ ICMP connectivity: WORKING"
|
|
else
|
|
echo " ❌ ICMP connectivity: FAILED"
|
|
fi
|
|
else
|
|
echo " ❌ No IPv6 found for node: $node_name"
|
|
fi
|
|
echo ""
|
|
done <<< "$PODS"
|
|
|
|
echo "📊 Summary:"
|
|
echo "This shows which nodes actually have pods and whether they're accessible"
|
|
echo ""
|
|
echo "If some URLs work and others don't, it means:"
|
|
echo " ✅ Working URLs: Nodes with good Mycelium connectivity"
|
|
echo " ❌ Failed URLs: Nodes with poor Mycelium connectivity or network issues"
|
|
echo ""
|
|
echo "To fix connectivity issues:"
|
|
echo " 1. Check Mycelium status on affected nodes"
|
|
echo " 2. Restart Mycelium on nodes with failed connectivity"
|
|
echo " 3. Scale to replicas only on nodes with good connectivity" |