Kubectl, the kubernetes client, needs context to work correctly. By default, it
uses the file on ~/.kube/config
, which has some problems. One is that you must
have all your configuration in one file (which means manually merging it). If
you've tried, it's awful. Another problem is that it's always pointing to a
cluster, which means that you always must know where you're pointing or you'll
have problems.
With this plugin, you won't have none of that problems. It searches in the
~/.kube
directory por files ended in -config
, like for example
~/.kube/something-config
. So, instead of having ~/.kube/config
you'll have
~/.kube/small-config
and ~/.kube/small2-config
. And since you don't need the
general config file, by default any kubectl command will point to localhost,
which is the default.
The usage is very simple, it has two commands, ksp
and kgp
. The first one
changes the context (with autocomplete support) and the second just shows which
one you're using.
What ksp
does under the hood is just change the
$KUBECONFIG
, which is the variable in which kubectl
searches for the
configuration file. This can be used with other cool stuff, for example to
visualize in your prompt the cluster and context in which you're working.
There's several ways projects that work with the prompt, the ones I know are this:
This plugin is based on the aws one.
MIT