简体   繁体   中英

Kubernetes can't get bash prompt when exec into pod

I am using Kubernetes to exec into a pod like this:

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.

Where -i passes stdin to the container and -t connects your terminal to this stdin.

Take a look at the following example:

kubectl exec -it myPod -- bash

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM