kubectx icon indicating copy to clipboard operation
kubectx copied to clipboard

Clear kubens selection

Open tunix opened this issue 1 year ago • 3 comments

Hi 👋🏻 ,

Is it possible to have a subcommand like clear for kubens where it clears current namespace?

This seems to be possible with kubectl config set-context --current --namespace=""

Maybe we can even do kubens "" but it prints an error that it couldn't find that namespace.

tunix avatar Oct 10 '24 21:10 tunix

kubens -f "" might work.

I see we have unset operation for ctx but not namespace. We could add, I'm surprised this never came up before.

ahmetb avatar Oct 11 '24 02:10 ahmetb

Unfortunetely that doesn't work:

kubens -f ""
error: too many flags
USAGE:
  kubens                    : list the namespaces in the current context
  kubens <NAME>             : change the active namespace of current context
  kubens -                  : switch to the previous namespace in this context
  kubens -c, --current      : show the current namespace
  kubens -h,--help          : show this message

How about kubens -u just like kubectx?

tunix avatar Oct 11 '24 07:10 tunix

There is a -u flag for kubectx, but not for kubens.

Image

n8petersen avatar Oct 30 '25 14:10 n8petersen