Kubectl: 获取 shell 到 Windows 下的 运行 容器
Kubectl: get a shell to a running container under Windows
我正在尝试根据 https://kubernetes.io/docs/tasks/debug-application-cluster/get-shell-running-container/ 中的说明使用 Kubectl 登录 运行 容器,但我失败得很惨:
kubectl exec -it mycontainer -- /bin/bash
Unable to use a TTY - input is not a terminal or the right kind of
file rpc error: code = 2 desc = oci runtime error: exec failed:
container_linux.go:247: starting container process caused "exec:
\"D:/Applications/Git/usr/bin/bash\": stat
D:/Applications/Git/usr/bin/bash: no such file or directory"
command terminated with exit code 126
看起来 kubectl 试图在我的机器上执行 bash,这完全不是我想要实现的。
我可以执行没有空格的命令:
$ kubectl exec mycontainer 'ls'
lib
start.sh
但是没有:
$ kubectl exec mycontainer 'ls .'
rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"ls .\": executable file not found in $PATH"
command terminated with exit code 126
我做错了什么?
我在 mingw git shell 中都试过了,就像普通的 windows 控制台一样。
我正在尝试根据 https://kubernetes.io/docs/tasks/debug-application-cluster/get-shell-running-container/ 中的说明使用 Kubectl 登录 运行 容器,但我失败得很惨:
kubectl exec -it mycontainer -- /bin/bash
Unable to use a TTY - input is not a terminal or the right kind of file rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"D:/Applications/Git/usr/bin/bash\": stat D:/Applications/Git/usr/bin/bash: no such file or directory"
command terminated with exit code 126
看起来 kubectl 试图在我的机器上执行 bash,这完全不是我想要实现的。
我可以执行没有空格的命令:
$ kubectl exec mycontainer 'ls'
lib
start.sh
但是没有:
$ kubectl exec mycontainer 'ls .'
rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"ls .\": executable file not found in $PATH"
command terminated with exit code 126
我做错了什么?
我在 mingw git shell 中都试过了,就像普通的 windows 控制台一样。