Skip to content

Commit f7dbad0

Browse files
author
Kasturi Narra
committed
Set CNI_MTU=1400 on kindnet daemonset to fix TCP DNS issues
1 parent 1045975 commit f7dbad0

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/cncf-conformance.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,71 @@ jobs:
9595
sudo podman exec "${node}" systemctl disable firewalld || true
9696
done
9797
98+
- name: Configure networking for CI environment
99+
shell: bash
100+
run: |
101+
set -euo pipefail
102+
103+
# Fix TCP DNS issues in GitHub Actions.
104+
# The issue manifests as TCP DNS failing while UDP works.
105+
# Apply multiple fixes to ensure TCP connectivity works properly.
106+
107+
echo "=== Step 1: Configure MTU on CNI config ==="
108+
for node in microshift-okd-1 microshift-okd-2; do
109+
echo " - Configuring MTU on ${node}"
110+
sudo podman exec "${node}" bash -c '
111+
CNI_CONFIG="/etc/cni/net.d/10-kindnet.conflist"
112+
if [ -f "$CNI_CONFIG" ]; then
113+
if grep -q "\"mtu\"" "$CNI_CONFIG"; then
114+
sed -i "s/\"mtu\": *[0-9]*/\"mtu\": 1400/g" "$CNI_CONFIG"
115+
else
116+
sed -i "s/\"type\": *\"ptp\"/\"type\": \"ptp\", \"mtu\": 1400/g" "$CNI_CONFIG"
117+
fi
118+
grep -o "\"mtu\": *[0-9]*" "$CNI_CONFIG" || echo " (mtu not in config)"
119+
fi
120+
'
121+
done
122+
123+
echo "=== Step 2: Set MTU on all network interfaces ==="
124+
for node in microshift-okd-1 microshift-okd-2; do
125+
sudo podman exec "${node}" bash -c '
126+
# Set MTU on all relevant interfaces
127+
for iface in $(ip -o link show | awk -F": " "{print \$2}" | cut -d@ -f1 | grep -v "^lo$"); do
128+
current_mtu=$(cat /sys/class/net/$iface/mtu 2>/dev/null || echo "0")
129+
if [ "$current_mtu" -gt 1400 ]; then
130+
ip link set dev "$iface" mtu 1400 2>/dev/null && echo " $iface: $current_mtu -> 1400" || true
131+
fi
132+
done
133+
' || true
134+
done
135+
136+
echo "=== Step 3: Restart kube-proxy to refresh iptables rules ==="
137+
make env CMD='kubectl rollout restart daemonset/kube-proxy -n kube-proxy'
138+
make env CMD='kubectl rollout status daemonset/kube-proxy -n kube-proxy --timeout=120s'
139+
140+
echo "=== Step 4: Restart CoreDNS to ensure clean TCP listeners ==="
141+
make env CMD='kubectl rollout restart daemonset/dns-default -n openshift-dns'
142+
make env CMD='kubectl rollout status daemonset/dns-default -n openshift-dns --timeout=120s'
143+
144+
echo "=== Step 5: Wait for network stabilization ==="
145+
sleep 30
146+
147+
echo "=== Step 6: Verify TCP DNS works ==="
148+
for node in microshift-okd-1 microshift-okd-2; do
149+
echo " Testing TCP DNS from ${node}..."
150+
sudo podman exec "${node}" bash -c '
151+
for i in 1 2 3; do
152+
result=$(dig +tcp +short kubernetes.default.svc.cluster.local @10.43.0.10 2>&1)
153+
if [ -n "$result" ] && [ "$result" != "" ]; then
154+
echo " Attempt $i: OK ($result)"
155+
else
156+
echo " Attempt $i: FAILED"
157+
fi
158+
sleep 1
159+
done
160+
'
161+
done
162+
98163
- name: Configure hostname resolution for cluster nodes
99164
shell: bash
100165
run: |

0 commit comments

Comments
 (0)