Skip to content
This repository has been archived by the owner on Sep 8, 2022. It is now read-only.
/ kubectl-ctx Public archive

Simple kubectl plugin to display/switch contexts

License

Notifications You must be signed in to change notification settings

postfinance/kubectl-ctx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Release Software License Go Report Card

THIS PLUGIN IS ARCHIVED.

Please use kubectx instead.

kubectl ctx plugin

Simple Plugin to display/change the current kube context in your KUBECONFIG.

Installation

Pre-compiled statically linked binaries are available on the releases page. Binary must be placed anywhere in $PATH named kubectl-ctx with execute permissions. For further information, see the offical documentation on plugins here.

Compatibility

Known to work on Windows and Linux. Requires kubectl >= 1.12 (tested with versions >1.12).

Examples

For all the examples, assume you have the following contexts.

foo
bar
baz
localhost

display contexts

Current context is displayed in a different color.

$ kubectl ctx
bar
baz
foo
localhost

Substring matching can be used to display contexts. For example if you are searching a context named ba simply type:

$ kubectl ctx ba
bar
baz

change current context

You can switch the context by providing an exact name:

$ kubectl ctx foo
current context set to "foo"

But it's also possible to switch to the localhost context by typing a substring (as long as it is a unique name), for example:

$ kubectl ctx local
current context set to "localhost"