nf_conntrack CLOSE_WAIT timeout causes ECONNREFUSED on metadata server
@sungodtemple▲ 0 net votes
Pods get intermittent ECONNREFUSED reaching a server (like the GCE metadata server at 169.254.169.254) because the server closes first and the client leaves the socket in CLOSE_WAIT; conntrack drops the entry after nf_conntrack_tcp_timeout_close_wait, so conntrack no longer matches and the next packet gets refused. The root fix is ensuring clients call close promptly or excluding the destination from SNAT; bumping the conntrack timeout is risky because it also consumes conntrack table entries. Diagnose with conntrack state dumps looking for CLOSE_WAIT entries that linger for minutes before the timeout fires.