kube-prompt icon indicating copy to clipboard operation
kube-prompt copied to clipboard

Set default namespace in a session

Open mitchellmaler opened this issue 3 years ago • 3 comments

Today you have to set the namespace when you start the session or specify it each command. It would be create to be able to switch the namespace or even the context while in a session.

Example proposal

!namespace "namespace autocomplete"
!ns "namespace autocomplete"

mitchellmaler avatar Aug 12 '20 15:08 mitchellmaler

Today you have to set the namespace when you start the session

How do you set the namespace to use when starting the session?

melkamar avatar Apr 27 '21 13:04 melkamar

@mitchellmaler I'd also like to know how can you set the default namespace before starting the session. I see that the tool accepts the command line argument to set the default namespace but it doesn't work for me somehow. I've tried all the following combinations.

kube-prompt --namespace "my-namespace" kube-prompt --namespace="my-namespace" kube-prompt -n "my-namespace" kube-prompt -n="my-namespace"

But when I get the pods using the get pods command, it only shows the pods from the default namespace only. If I use get pods -n my namespace then it shows the pods from the namespace. Somehow it is not setting a different namespace from the beginning.

zzeebbii avatar Jul 29 '21 08:07 zzeebbii

I'd also like to see it implemented as a command-line option.

I'm currently running kube-prompt inside a Docker container. My workaround is executing this command before kube-prompt:

kubectl config set-context --current --namespace=WHATEVER

kaime avatar Jun 16 '22 19:06 kaime