mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
dump conntrack table on e2e conntrack failures
Signed-off-by: Antonio Ojea <antonio.ojea.garcia@gmail.com>
This commit is contained in:
parent
db8a88721e
commit
0ef7f27fc1
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package network
|
package network
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -116,6 +117,9 @@ var _ = SIGDescribe("Conntrack", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
ginkgo.It("should be able to preserve UDP traffic when server pod cycles for a NodePort service", func() {
|
ginkgo.It("should be able to preserve UDP traffic when server pod cycles for a NodePort service", func() {
|
||||||
|
// TODO(#91236): Remove once the test is debugged and fixed.
|
||||||
|
// dump conntrack table for debugging
|
||||||
|
defer dumpConntrack(cs)
|
||||||
|
|
||||||
// Create a NodePort service
|
// Create a NodePort service
|
||||||
udpJig := e2eservice.NewTestJig(cs, ns, serviceName)
|
udpJig := e2eservice.NewTestJig(cs, ns, serviceName)
|
||||||
@ -193,6 +197,9 @@ var _ = SIGDescribe("Conntrack", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
ginkgo.It("should be able to preserve UDP traffic when server pod cycles for a ClusterIP service", func() {
|
ginkgo.It("should be able to preserve UDP traffic when server pod cycles for a ClusterIP service", func() {
|
||||||
|
// TODO(#91236): Remove once the test is debugged and fixed.
|
||||||
|
// dump conntrack table for debugging
|
||||||
|
defer dumpConntrack(cs)
|
||||||
|
|
||||||
// Create a ClusterIP service
|
// Create a ClusterIP service
|
||||||
udpJig := e2eservice.NewTestJig(cs, ns, serviceName)
|
udpJig := e2eservice.NewTestJig(cs, ns, serviceName)
|
||||||
@ -269,3 +276,24 @@ var _ = SIGDescribe("Conntrack", func() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
func dumpConntrack(cs clientset.Interface) {
|
||||||
|
// Dump conntrack table of each node for troubleshooting using the kube-proxy pods
|
||||||
|
namespace := "kube-system"
|
||||||
|
pods, err := cs.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{})
|
||||||
|
if err != nil || len(pods.Items) == 0 {
|
||||||
|
framework.Logf("failed to list kube-proxy pods in namespace: %s", namespace)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
cmd := "conntrack -L"
|
||||||
|
for _, pod := range pods.Items {
|
||||||
|
if strings.Contains(pod.Name, "kube-proxy") {
|
||||||
|
stdout, err := framework.RunHostCmd(namespace, pod.Name, cmd)
|
||||||
|
if err != nil {
|
||||||
|
framework.Logf("Failed to dump conntrack table of node %s: %v", pod.Spec.NodeName, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
framework.Logf("conntrack table of node %s: %s", pod.Spec.NodeName, stdout)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user