mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-21 18:11:22 +00:00
kube-proxy should log the payload when iptables-restore fails
Signed-off-by: cyclinder <qifeng.guo@daocloud.io>
This commit is contained in:
@@ -1515,7 +1515,12 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
klog.V(5).InfoS("Restoring iptables", "rules", proxier.iptablesData.Bytes())
|
||||
err = proxier.iptables.RestoreAll(proxier.iptablesData.Bytes(), utiliptables.NoFlushTables, utiliptables.RestoreCounters)
|
||||
if err != nil {
|
||||
klog.ErrorS(err, "Failed to execute iptables-restore")
|
||||
if pErr, ok := err.(utiliptables.ParseError); ok {
|
||||
lines := utiliptables.ExtractLines(proxier.iptablesData.Bytes(), pErr.Line(), 3)
|
||||
klog.ErrorS(pErr, "Failed to execute iptables-restore", "rules", lines)
|
||||
} else {
|
||||
klog.ErrorS(err, "Failed to execute iptables-restore")
|
||||
}
|
||||
metrics.IptablesRestoreFailuresTotal.Inc()
|
||||
// Revert new local ports.
|
||||
klog.V(2).InfoS("Closing local ports after iptables-restore failure")
|
||||
|
@@ -1607,7 +1607,12 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
klog.V(5).InfoS("Restoring iptables", "rules", string(proxier.iptablesData.Bytes()))
|
||||
err = proxier.iptables.RestoreAll(proxier.iptablesData.Bytes(), utiliptables.NoFlushTables, utiliptables.RestoreCounters)
|
||||
if err != nil {
|
||||
klog.ErrorS(err, "Failed to execute iptables-restore", "rules", string(proxier.iptablesData.Bytes()))
|
||||
if pErr, ok := err.(utiliptables.ParseError); ok {
|
||||
lines := utiliptables.ExtractLines(proxier.iptablesData.Bytes(), pErr.Line(), 3)
|
||||
klog.ErrorS(pErr, "Failed to execute iptables-restore", "rules", lines)
|
||||
} else {
|
||||
klog.ErrorS(err, "Failed to execute iptables-restore", "rules", string(proxier.iptablesData.Bytes()))
|
||||
}
|
||||
metrics.IptablesRestoreFailuresTotal.Inc()
|
||||
// Revert new local ports.
|
||||
utilproxy.RevertPorts(replacementPortsMap, proxier.portsMap)
|
||||
|
Reference in New Issue
Block a user