【发布时间】:2019-11-22 22:29:10
【问题描述】:
我有一个简单的自动化来执行到 kubernetes pod 中,但它总是导致以下错误:-
kubectl exec -it my-pod -c my-contaner -n my-namespace /bin/bash
Unable to use a TTY - input is not a terminal or the right kind of file
我正在尝试使用 jenkins 运行一个简单的 shell 脚本来执行到一个 pod 并在根目录中执行 ls -las 但它不允许自动执行到 pod 中。如果我在 linux 服务器终端上手动操作,同样的事情也可以正常工作。 有人可以帮忙解决这个问题吗
【问题讨论】:
-
如果这是自动化,你可能不想要
-it -
感谢 coderanger 但是我如何从 pod 内执行命令,因为登录永远不会像看起来或看起来那样发生,即使它确实发生了,但那里没有会话。我正在寻找的只是执行到 pod 并在登录后执行 bla bla bla
-
如果这是一个脚本,你可能会运行类似
kubectl exec my-pod -c my-contaner -n my-namespace -- /bin/bash /myscript.sh -
啊,我只是在运行 kubectl exec -it my-pod -c my-contaner -n my-namespace /bin/bash && ls -las 并且永远不会与 pod/container 建立 shell 会话
-
我的意思是它可以交互地工作,但你不能从脚本中做到这一点。无论您正在做什么,您都需要真正实现自动化。
标签: shell jenkins kubernetes kubectl kubernetes-pod