Minikube 在使用 Alpine linux 执行到 Pod 时崩溃
Minikube crashes exec'ing into Pod using Alpine linux
每次我尝试通过 minikube 仪表板 运行ning alpine linux 执行到 pod 时,它会崩溃并关闭连接并出现以下错误
rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:262: starting container process caused "exec: \"bash\": executable file not found in $PATH"
CONNECTION CLOSED
命令 "kubectl version" 的输出内容如下:
Client Version: version.Info{Major:"1", Minor:"8",
GitVersion:"v1.8.0", GitCommit:"6e937839ac04a38cac63e6a7a306c5d035fe7b0a", GitTreeState:"clean", BuildDate:"2017-09-28T22:57:57Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"8",
GitVersion:"v1.8.0",
GitCommit:"0b9efaeb34a2fc51ff8e4d34ad9bc6375459c4a4",
GitTreeState:"clean", BuildDate:"2017-11-29T22:43:34Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"linux/amd64"}
有人可以指点一下吗?我可以 运行 其他容器,只要它们有 BASH 而不是 ASH。
非常感谢
通常 Alpine linux 不包含 bash。
您是否尝试过使用以下任何一项执行到容器中?
/bin/ash
/bin/sh
ash
sh
因此,例如 kubectl exec -it my-alpine-shell-293fj2fk-fifni2 -- sh
应该可以完成这项工作。
Everytime I try and exec into a pod
您没有指定您提供给 kubectl exec
的命令,但根据您的问题,我假设它是 kubectl exec -it $pod -- bash
如错误消息所述,问题在于您使用的容器映像未提供 bash。许多 "slim" 图像不随 bash
一起提供,因为这样做会带来依赖关系。
如果你想要一个适用于所有图像的命令,请使用 sh
,因为如果 bash
存在,90% 的时间,它会被符号链接到 /bin/sh
和另一个情况下(如您提到的 ash
或 dash
或其他),然后使用 sh
仍然 有效 并允许您确定是否需要调整专门请求不同 shell.
的命令
因此 kubectl exec -it $pod -- sh
是我期望工作的命令
每次我尝试通过 minikube 仪表板 运行ning alpine linux 执行到 pod 时,它会崩溃并关闭连接并出现以下错误
rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:262: starting container process caused "exec: \"bash\": executable file not found in $PATH"
CONNECTION CLOSED
命令 "kubectl version" 的输出内容如下:
Client Version: version.Info{Major:"1", Minor:"8",
GitVersion:"v1.8.0", GitCommit:"6e937839ac04a38cac63e6a7a306c5d035fe7b0a", GitTreeState:"clean", BuildDate:"2017-09-28T22:57:57Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"8",
GitVersion:"v1.8.0",
GitCommit:"0b9efaeb34a2fc51ff8e4d34ad9bc6375459c4a4",
GitTreeState:"clean", BuildDate:"2017-11-29T22:43:34Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"linux/amd64"}
有人可以指点一下吗?我可以 运行 其他容器,只要它们有 BASH 而不是 ASH。
非常感谢
通常 Alpine linux 不包含 bash。 您是否尝试过使用以下任何一项执行到容器中?
/bin/ash
/bin/sh
ash
sh
因此,例如 kubectl exec -it my-alpine-shell-293fj2fk-fifni2 -- sh
应该可以完成这项工作。
Everytime I try and exec into a pod
您没有指定您提供给 kubectl exec
的命令,但根据您的问题,我假设它是 kubectl exec -it $pod -- bash
如错误消息所述,问题在于您使用的容器映像未提供 bash。许多 "slim" 图像不随 bash
一起提供,因为这样做会带来依赖关系。
如果你想要一个适用于所有图像的命令,请使用 sh
,因为如果 bash
存在,90% 的时间,它会被符号链接到 /bin/sh
和另一个情况下(如您提到的 ash
或 dash
或其他),然后使用 sh
仍然 有效 并允许您确定是否需要调整专门请求不同 shell.
因此 kubectl exec -it $pod -- sh
是我期望工作的命令