[英]Kubernetes can't get bash prompt when exec into pod
I am using Kubernetes to exec into a pod like this:我正在使用 Kubernetes 执行到这样的 pod:
kubectl exec myPod bash -i
which works fine, except I don't get a prompt.这工作正常,除了我没有得到提示。 So then I do:那么我这样做:
export PS1="myPrompt "
Which I would expect to give me a prompt, but doesn't.我希望给我一个提示,但没有。 Is there some workaround for this?有什么解决方法吗?
Trying to exec into pod in interactive way requires specifying -ti
option.尝试以交互方式执行 pod 需要指定-ti
选项。
Where -i
passes stdin to the container and -t
connects your terminal to this stdin.其中-i
将 stdin 传递给容器, -t
将您的终端连接到此 stdin。
Take a look at the following example:看看下面的例子:
kubectl exec -it myPod -- bash
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.