Skip to content

Commit c7d337f

Browse files
authored
fix: flush the CNI-HOSTPORT-DNAT chain on stop (#4963) (#4970)
`microk8s stop` was changed to fully remove containers via ctr(#4755) which results in an old DNAT rule getting left-over that points to the old container id. flushing the chain should fix issues of hostPort connections dropping after a stop & start. (cherry picked from commit b170cad)
1 parent dc2065b commit c7d337f

File tree

1 file changed

+2
-0
lines changed
  • microk8s-resources/actions/common

1 file changed

+2
-0
lines changed

microk8s-resources/actions/common/utils.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,8 @@ remove_all_containers() {
990990
do
991991
"${SNAP}/microk8s-ctr.wrapper" container delete $container &>/dev/null || true
992992
done
993+
994+
iptables-legacy -t nat -F CNI-HOSTPORT-DNAT || true
993995
}
994996

995997
get_container_shim_pids() {

0 commit comments

Comments
 (0)