kubectl exec 失败并出现错误“无法使用 TTY - 输入不是终端或正确的文件类型" [英] kubectl exec fails with the error "Unable to use a TTY - input is not a terminal or the right kind of file"
问题描述
我正在使用以下命令运行 jenkins 管道:
I am running a jenkins pipeline with the following command:
kubectl exec -it kafkacat-5f8fcfcc57-2txhc -- kafkacat -b cord-kafka -C -t BBSim-OLT-0-Events -o s@1585031458
在运行管道的机器的终端上运行良好,但在实际管道上我收到以下错误:无法使用 TTY - 输入不是终端或正确的文件类型"
which is running fine on the terminal of the machine the pipeline is running on, but on the actual pipeline I get the following error: "Unable to use a TTY - input is not a terminal or the right kind of file"
关于如何解决这个问题的任何提示?
Any tips on how to go about resolving this?
推荐答案
当flags -it
与 kubectl exec
一起使用,它启用了 TTY 交互模式.鉴于您提到的错误,Jenkins 似乎没有分配 TTY.
When the flags -it
are used with kubectl exec
, it enables the TTY interactive mode. Given the error that you mentioned, it seems that Jenkins doesn't allocate a TTY.
由于您在 Jenkins 作业中运行该命令,我假设您的命令不一定是交互式的.该问题的一个可能解决方案是简单地删除 -t
标志并尝试执行以下命令:
Since you are running the command in a Jenkins job, I would assume that your command is not necessarily interactive. A possible solution for the problem would be to simply remove the -t
flag and try to execute the following instead:
kubectl exec -i kafkacat-5f8fcfcc57-2txhc -- kafkacat -b cord-kafka -C -t BBSim-OLT-0-Events -o s@1585031458
这篇关于kubectl exec 失败并出现错误“无法使用 TTY - 输入不是终端或正确的文件类型"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!