From ab43e2b8090993d849918aac8ab1681c541b0f11 Mon Sep 17 00:00:00 2001 From: Cao Shufeng Date: Mon, 5 Dec 2016 07:40:29 -0500 Subject: [PATCH] [hairpin] fix argument of nsenter We should use: nsenter --net=netnsPath -- -F some_command instend of: nsenter -n netnsPath -- -F some_command Because "nsenter -n netnsPath" get an error output: # nsenter -n /proc/67197/ns/net ip addr nsenter: neither filename nor target pid supplied for ns/net If we really want use -n, we need to use -n in such format: # sudo nsenter -n/proc/67197/ns/net ip addr --- pkg/kubelet/network/hairpin/hairpin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/kubelet/network/hairpin/hairpin.go b/pkg/kubelet/network/hairpin/hairpin.go index 1bbcc496949..928c88085f2 100644 --- a/pkg/kubelet/network/hairpin/hairpin.go +++ b/pkg/kubelet/network/hairpin/hairpin.go @@ -50,7 +50,7 @@ func SetUpContainerPath(netnsPath string, containerInterfaceName string) error { if netnsPath[0] != '/' { return fmt.Errorf("netnsPath path '%s' was invalid", netnsPath) } - nsenterArgs := []string{"-n", netnsPath} + nsenterArgs := []string{"--net=" + netnsPath} return setUpContainerInternal(containerInterfaceName, netnsPath, nsenterArgs) }