Change:
import ( "context" "fmt" <del> "io/ioutil" "net/http" "strconv" "strings" </del> <ins> "net" </ins> "time" <ins> "github.com/onsi/ginkgo" </ins> v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" <del> "k8s.io/kubernetes/test/e2e/framework" "github.com/onsi/ginkgo" </del> <ins> "k8s.io/kubernetes/test/e2e/framework" </ins> imageutils "k8s.io/kubernetes/test/utils/image" ) const ( <del> testPodPort = 8080 testProxyPort = 31235 // Firewall rule allows external traffic on ports 30000-32767. I just picked a random one. </del> <ins> testPodPort    = "8080" noSNATTestName = "no-snat-test" </ins> ) var ( testPod = v1.Pod{ ObjectMeta: metav1.ObjectMeta{ <del> GenerateName: "no-snat-test", </del> <ins> GenerateName: noSNATTestName, </ins> Labels: map[string]string{ <del> "no-snat-test": "", </del> <ins> noSNATTestName: "", </ins> }, }, Spec: v1.PodSpec{ Containers: []v1.Container{ { <del> Name:  "no-snat-test", </del> <ins> Name:  noSNATTestName, </ins> Image: imageutils.GetE2EImage(imageutils.Agnhost), <del> Args:  []string{"no-snat-test", "--port", strconv.Itoa(testPodPort)}, Env: []v1.EnvVar{ { Name:      "POD_IP", ValueFrom: &v1.EnvVarSource{FieldRef: &v1.ObjectFieldSelector{FieldPath: "status.podIP"}}, }, }, }, }, }, } testProxyPod = v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: "no-snat-test-proxy", }, Spec: v1.PodSpec{ HostNetwork: true, Containers: []v1.Container{ { Name:  "no-snat-test-proxy", Image: imageutils.GetE2EImage(imageutils.Agnhost), Args:  []string{"no-snat-test-proxy", "--port", strconv.Itoa(testProxyPort)}, Ports: []v1.ContainerPort{ { ContainerPort: testProxyPort, HostPort:      testProxyPort, }, }, </del> <ins> Args:  []string{"netexec", "--http-port", testPodPort}, </ins> }, }, }, } ) <del> // Produces a pod spec that passes nip as NODE_IP env var using downward API func newTestPod(nodename string, nip string) *v1.Pod { pod := testPod nodeIP := v1.EnvVar{ Name:  "NODE_IP", Value: nip, } pod.Spec.Containers[0].Env = append(pod.Spec.Containers[0].Env, nodeIP) pod.Spec.NodeName = nodename return &pod } func newTestProxyPod(nodename string) *v1.Pod { pod := testProxyPod pod.Spec.NodeName = nodename return &pod } func getIP(iptype v1.NodeAddressType, node *v1.Node) (string, error) { for _, addr := range node.Status.Addresses { if addr.Type == iptype { return addr.Address, nil } } return "", fmt.Errorf("did not find %s on Node", iptype) } func getSchedulable(nodes []v1.Node) (*v1.Node, error) { for _, node := range nodes { if !node.Spec.Unschedulable { return &node, nil } } return nil, fmt.Errorf("all Nodes were unschedulable") } func checknosnatURL(proxy, pip string, ips []string) string { return fmt.Sprintf("http://%s/checknosnat?target=%s&ips=%s", proxy, pip, strings.Join(ips, ",")) } </del> // This test verifies that a Pod on each node in a cluster can talk to Pods on every other node without SNAT. // We use the [Feature:NoSNAT] tag so that most jobs will skip this test by default. var _ = SIGDescribe("NoSNAT [Feature:NoSNAT] [Slow]", func() {

Discussion:
What would you like to be : The test currently only works on Cloud Providers or environments that set the External IP on nodes, because it is using the framework directly to check the IPs of the pods, using a no-snat-test-proxy to check if the Pods are not using SNAT. However, this can be simplified, removing the no-snat-test-proxy Pod and executing the queries directly in a Pod. Why is this needed: The test should work in all environments, and it's failing https://k8s-,%20master&include-filter-by-regex=NoSNAT
/sig network /help wanted /failing test
/remove kind-feature /kind failing-test
/help
This request has been marked as needing help from a contributor. Please ensure the request meets the requirements listed . If this request no longer meets these requirements, the label can be removed by commenting with the command. <detailsIn response to : /help Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
/remove kind-feature
/triage unresolved Comment when the issue is assessed and confirmed. I am a bot run by vllry. ‍
I would like to investigate this problem. /assign
I have filed , how could I verify if my patch fixes the problem?
I run them locally with KIND