mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Merge pull request #32413 from freehan/hostportfix
Automatic merge from submit-queue Fix a bug in kubelet hostport logic which flushes KUBE-MARK-MASQ iptables chain Fixes #32415
This commit is contained in:
commit
e43f605759
@ -251,14 +251,6 @@ func (h *handler) SyncHostports(natInterfaceName string, runningPods []*RunningP
|
|||||||
} else {
|
} else {
|
||||||
writeLine(natChains, utiliptables.MakeChainLine(kubeHostportsChain))
|
writeLine(natChains, utiliptables.MakeChainLine(kubeHostportsChain))
|
||||||
}
|
}
|
||||||
// Assuming the node is running kube-proxy in iptables mode
|
|
||||||
// Reusing kube-proxy's KubeMarkMasqChain for SNAT
|
|
||||||
// TODO: let kubelet manage KubeMarkMasqChain. Other components should just be able to use it
|
|
||||||
if chain, ok := existingNATChains[iptablesproxy.KubeMarkMasqChain]; ok {
|
|
||||||
writeLine(natChains, chain)
|
|
||||||
} else {
|
|
||||||
writeLine(natChains, utiliptables.MakeChainLine(iptablesproxy.KubeMarkMasqChain))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Accumulate NAT chains to keep.
|
// Accumulate NAT chains to keep.
|
||||||
activeNATChains := map[utiliptables.Chain]bool{} // use a map as a set
|
activeNATChains := map[utiliptables.Chain]bool{} // use a map as a set
|
||||||
@ -284,6 +276,7 @@ func (h *handler) SyncHostports(natInterfaceName string, runningPods []*RunningP
|
|||||||
}
|
}
|
||||||
writeLine(natRules, args...)
|
writeLine(natRules, args...)
|
||||||
|
|
||||||
|
// Assuming kubelet is syncing iptables KUBE-MARK-MASQ chain
|
||||||
// If the request comes from the pod that is serving the hostport, then SNAT
|
// If the request comes from the pod that is serving the hostport, then SNAT
|
||||||
args = []string{
|
args = []string{
|
||||||
"-A", string(hostportChain),
|
"-A", string(hostportChain),
|
||||||
|
Loading…
Reference in New Issue
Block a user