mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
add accept for ipvs
This commit is contained in:
@@ -1318,6 +1318,11 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
writeLine(proxier.natRules, append(args, "-j", string(KubeMarkMasqChain))...)
|
||||
}
|
||||
|
||||
// Accept all traffic with destination of ipvs virtual service, in case other iptables rules
|
||||
// block the traffic, that may result in ipvs rules invalid.
|
||||
// Those rules must be in the end of KUBE-SERVICE chain
|
||||
proxier.acceptIPVSTraffic()
|
||||
|
||||
// If the masqueradeMark has been added then we want to forward that same
|
||||
// traffic, this allows NodePort traffic to be forwarded even if the default
|
||||
// FORWARD policy is not accept.
|
||||
@@ -1415,6 +1420,26 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
proxier.deleteEndpointConnections(endpointUpdateResult.StaleEndpoints)
|
||||
}
|
||||
|
||||
func (proxier *Proxier) acceptIPVSTraffic() {
|
||||
sets := []*IPSet{proxier.clusterIPSet, proxier.externalIPSet, proxier.lbIngressSet}
|
||||
for _, set := range sets {
|
||||
var matchType string
|
||||
if !set.isEmpty() {
|
||||
switch set.SetType {
|
||||
case utilipset.BitmapPort:
|
||||
matchType = "dst"
|
||||
default:
|
||||
matchType = "dst,dst"
|
||||
}
|
||||
writeLine(proxier.natRules, []string{
|
||||
"-A", string(kubeServicesChain),
|
||||
"-m", "set", "--match-set", set.Name, matchType,
|
||||
"-j", "ACCEPT",
|
||||
}...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// After a UDP endpoint has been removed, we must flush any pending conntrack entries to it, or else we
|
||||
// risk sending more traffic to it, all of which will be lost (because UDP).
|
||||
// This assumes the proxier mutex is held
|
||||
|
||||
Reference in New Issue
Block a user