mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
fix kubelet iptclient in ipv6 cluster
This commit is contained in:
parent
330cf37e0a
commit
67f4be87c0
@ -473,6 +473,11 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
|||||||
}
|
}
|
||||||
httpClient := &http.Client{}
|
httpClient := &http.Client{}
|
||||||
parsedNodeIP := net.ParseIP(nodeIP)
|
parsedNodeIP := net.ParseIP(nodeIP)
|
||||||
|
protocol := utilipt.ProtocolIpv4
|
||||||
|
if parsedNodeIP != nil && parsedNodeIP.To4() == nil {
|
||||||
|
glog.V(0).Infof("IPv6 node IP (%s), assume IPv6 operation", nodeIP)
|
||||||
|
protocol = utilipt.ProtocolIpv6
|
||||||
|
}
|
||||||
|
|
||||||
klet := &Kubelet{
|
klet := &Kubelet{
|
||||||
hostname: hostname,
|
hostname: hostname,
|
||||||
@ -515,7 +520,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
|||||||
nodeIPValidator: validateNodeIP,
|
nodeIPValidator: validateNodeIP,
|
||||||
clock: clock.RealClock{},
|
clock: clock.RealClock{},
|
||||||
enableControllerAttachDetach: kubeCfg.EnableControllerAttachDetach,
|
enableControllerAttachDetach: kubeCfg.EnableControllerAttachDetach,
|
||||||
iptClient: utilipt.New(utilexec.New(), utildbus.New(), utilipt.ProtocolIpv4),
|
iptClient: utilipt.New(utilexec.New(), utildbus.New(), protocol),
|
||||||
makeIPTablesUtilChains: kubeCfg.MakeIPTablesUtilChains,
|
makeIPTablesUtilChains: kubeCfg.MakeIPTablesUtilChains,
|
||||||
iptablesMasqueradeBit: int(kubeCfg.IPTablesMasqueradeBit),
|
iptablesMasqueradeBit: int(kubeCfg.IPTablesMasqueradeBit),
|
||||||
iptablesDropBit: int(kubeCfg.IPTablesDropBit),
|
iptablesDropBit: int(kubeCfg.IPTablesDropBit),
|
||||||
|
Loading…
Reference in New Issue
Block a user