kvaps / kubectl-node-shell

Exec into node via kubectl
Apache License 2.0
1.46k stars 173 forks source link

Support space char in context name #49

Open fadam-csgroup opened 1 year ago

fadam-csgroup commented 1 year ago

I added some spaces character in my Kubernetes contexte name. For example my first cluster.

In such a case, running the plugin give the following result, and returned code is 1.

kubectl node-shell my-node
Error: flags cannot be placed before plugin name: --context=my

A workaround is to generated a (temporary) kube config file without space, like this: kubectl config view --minify --flatten | sed -r 's/: ([[:alnum:]-]+) /: \1-/;s/: ([[:alnum:]-]+) /: \1-/', and use it with this plugin.