错误现象
执行脚本,脚本内部是个简单的批量pod的操作
kubectl -n mytest get pod | grep nginx | awk '{print "kubectl -n mytest exec -it "$1" -- bash cleanlog.sh"}'|sh
Unable to use a TTY - input is not a terminal or the right kind of file
查看帮助信息
Options:
-c, --container='': Container name. If omitted, the first container in the pod will be chosen
-f, --filename=[]: to use to exec into the resource
--pod-running-timeout=1m0s: The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one
pod is running
-i, --stdin=false: Pass stdin to the container
-t, --tty=false: Stdin is a TTY ,这里需要创建一个交互TTY终端,可以考虑取掉-t参数
修正解决
kubectl -n mytest get pod | grep nginx | awk '{print "kubectl -n mytest exec -i "$1" -- bash cleanlog.sh"}'|sh
本文暂时没有评论,来添加一个吧(●'◡'●)