mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 13:42:02 +00:00
Merge pull request #38101 from CaoShuFeng/haripin_nsenter
Automatic merge from submit-queue (batch tested with PRs 38101, 41431, 39606, 41569, 41509) [hairpin] fix argument of nsenter **Release note**: ```release-note None ``` 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
This commit is contained in:
@@ -50,7 +50,7 @@ func SetUpContainerPath(netnsPath string, containerInterfaceName string) error {
|
|||||||
if netnsPath[0] != '/' {
|
if netnsPath[0] != '/' {
|
||||||
return fmt.Errorf("netnsPath path '%s' was invalid", netnsPath)
|
return fmt.Errorf("netnsPath path '%s' was invalid", netnsPath)
|
||||||
}
|
}
|
||||||
nsenterArgs := []string{"-n", netnsPath}
|
nsenterArgs := []string{"--net=" + netnsPath}
|
||||||
return setUpContainerInternal(containerInterfaceName, netnsPath, nsenterArgs)
|
return setUpContainerInternal(containerInterfaceName, netnsPath, nsenterArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user