我登录了Kubernetes etcd pod
kubectl exec -it -n kube-system etcd-master -- /bin/sh我不知道这是什么操作系统。
ls不起作用
sh-5.0# ls
sh: ls: command not found猫不管用
sh-5.0# cat /etc/os-release
sh: cat: command not foundapt,yum未被识别
sh-5.0# apt
sh: apt: command not found
sh-5.0# yum
sh: yum: command not found我只能通过模式扩展来cd和列表文件。
sh-5.0# cd /etc
sh-5.0# echo *
debian_version default dpkg group host.conf hostname hosts issue issue.net kubernetes network nsswitch.conf os-release passwd profile.d protocols resolv.conf rpc services skel ssl update-motd.d
sh-5.0# echo `<os-release`
PRETTY_NAME="Distroless" NAME="Debian GNU/Linux" ID="debian" VERSION_ID="9" VERSION="Debian GNU/Linux 9 (stretch)" HOME_URL="https://github.com/GoogleContainerTools/distroless" SUPPORT_URL="https://github.com/GoogleContainerTools/distroless/blob/master/README.md" BUG_REPORT_URL="https://github.com/GoogleContainerTools/distroless/issues/new"这是什么操作系统?怎么在这里安装bash?
发布于 2021-09-13 07:52:33
/etc/os-release声明图像是基于Distroless的。给出的URL解释说:
“无分辨”映像只包含应用程序及其运行时依赖项。它们不包含包管理器、shell或其他您希望在标准Linux发行版中找到的程序。 有关更多信息,请参见此谈话 (视频)。
这是最好的做法之一,容器只留下绝对必要的东西在里面。您可能会遇到许多这样的图像,有些甚至不会在其中包含sh。此外,根文件系统可以只读,并且/或容器可能没有足够的权限来安装东西。
考虑到所有这些,您可能无法将bash或其他任何东西带入其中。根据你的实际目标,你可以:
kubectl cp从容器中复制文件(需要图像中的tar );docker cp将bash二进制文件推入正在运行的容器中。发布于 2021-09-13 07:57:06
从PRETTY_NAME判断,它是无分辨的(https://github.com/GoogleContainerTools/distroless)。在他们的自述中,你可以阅读
谁使用无分辨的?
这可能是你的案子。
https://stackoverflow.com/questions/69158462
复制相似问题