kubectl exec到pod中,如果通过自动化运行,则每次都无法使用TTY错误 [英] kubectl exec into pod resulting in Unable to use a TTY error every time if run through automation

查看:95
本文介绍了kubectl exec到pod中,如果通过自动化运行,则每次都无法使用TTY错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的自动化程序,可以执行到kubernetes容器中,但是它总是导致以下错误:-

i have a simple automation to exec into a kubernetes pod but it always results in the below error :-

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服务器终端上手动进行操作,同样的事情也可以正常工作. 有人可以帮忙解决此问题

I am trying to run a simple shell script using jenkins to exec into a pod and execute ls -las in the root directory but its not allowing to exec into the pod automatically. The same thing works fine if i do manually on the linux server terminal. Can someone help fix this issue

推荐答案

我使用以下方法使其正常工作:-

I got it working using the below approach :-

kubectl exec -ti my-pod -c my-container -n my-namespace -- ls

这篇关于kubectl exec到pod中,如果通过自动化运行,则每次都无法使用TTY错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆