【发布时间】:2022-11-30 15:25:52
【问题描述】:
我已经阅读了许多与我的问题类似的链接,但没有一个能帮助我解决问题。
类似链接:
- Failed to exec into the container due to permission issue after executing 'systemctl daemon-reload'
- OCI runtime exec failed: exec failed: unable to start container process: open /dev/pts/0: operation not permitted: unknown
- CI runtime exec failed: exec failed: unable to start container process: open /dev/pts/0: operation not permitted: unknown
- OCI runtime exec failed: exec failed: unable to start container process: open /dev/pts/0: operation not permitted: unknown
- Fail to execute docker exec
-
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "open /proc/self/fd: no such file or directory": unknown
问题描述:
我使用
Kubespray创建了一个新的 Kubernetes 集群。当我想在其中一个容器中执行一些命令时,我遇到了以下错误:执行命令
kubectl exec -it -n rook-ceph rook-ceph-tools-68d847b88d-7kw2v -- sh错误:
OCI runtime exec failed: exec failed: unable to start container process: open /dev/pts/1: operation not permitted: 未知 命令以退出代码 126 终止
我也登录到运行 pod 的节点,并尝试使用
docker exec命令执行容器,但错误没有改变。解决方法:
-
正如我所发现的,错误代码(126)意味着权限不足,但我没有在 Docker 或 Kubernetes 中遇到过这种错误(如执行
sh)。 -
我还检查了是否启用了
SELinux(如第三个链接所述)。apt install policycoreutils sestatus # Output SELinux status: disabled -
第5个链接说检查你有没有更新内核,我在节点上没有升级任何东西。
id; stat /dev/pts/0 # output uid=0(root) gid=0(root) groups=0(root) File: /dev/pts/0 Size: 0 Blocks: 0 IO Block: 1024 character special file Device: 18h/24d Inode: 3 Links: 1 Device type: 88,0 Access: (0600/crw-------) Uid: ( 0/ root) Gid: ( 5/ tty) Access: 2022-08-21 12:01:25.409456443 +0000 Modify: 2022-08-21 12:01:25.409456443 +0000 Change: 2022-08-21 11:54:47.474457646 +0000 Birth: - -
还尝试了
/bin/sh而不是sh或/bin/bash,但没有成功,并且出现了同样的错误。
任何人都可以帮我找到这个问题的根本原因然后解决吗?
-
【问题讨论】:
-
kubectl run debug --image=alpine -i --tty -- sh你能检查这个命令是否有效吗 -
@Adiii 它有效,但它不适用于执行现有的 pod,如
rook-ceph-tools-68d847b88d-7kw2v,我在这里提到过。 -
有没有卷挂载?图像是否支持您的平台?
k describe node node_name | grep "kubernetes.io/arch" -
docker inspect image my-image | grep Architecture节点和图像架构应该匹配,如果不匹配则需要重建图像 -
docker build --platform linux/x86-64 -t demo-image .或platform linux/amd64
标签: docker kubernetes containerd runc rook-ceph