Faster way to switch between kubeconfig files.
Usage of kubectl-cf:
cf Select kubeconfig interactively
cf [config] Select kubeconfig directly
cf - Switch to the previous kubeconfig
brew tap junchaw/awesome
brew install kubectl-cf
kubectl-cf -h
docker run junchaw/kubectl-cf -h
First, download tar file from the release page.
After downloading the tar file, extract it, then put kubectl-cf
in your PATH
.
git clone https://github.com/junchaw/kubectl-cf.git
cd kubectl-cf && make build
./bin/kubectl-cf -h
kubectl-cf
can be called directly by typing kubectl-cf
,
or as a kubectl plugin
kubectl cf
, because it has the kubectl-
prefix.
You may want to set an alias for kubectl-cf
, like alias cf='kubectl cf'
.
kubectl-cf
maintains kubeconfig symlinks for you,
and updates the symlink when you switch kubeconfig
kubectl-cf
respects the KUBECONFIG
environment variable,
if it's set, kubectl-cf
will use it as the kubeconfig file symlink.
By default, kubectl-cf
reads kubeconfig files from the directory of the given kubeconfig file,
you can change this by setting the KUBECTL_CF_PATHS
environment variable, for example:
"@kubeconfig-dir" is a special path, it means the directory of the given kubeconfig file
export KUBECTL_CF_PATHS="~/.kube:~/another-kube-dir:~/yet-another-kube-dir:@kubeconfig-dir"
By default, kubectl-cf
grep kubeconfig files with regex pattern ^(?P<name>(config)|([^\.]+\.yaml))$
,
you can change this by setting the KUBECTL_CF_KUBECONFIG_MATCH_PATTERN
environment variable,
for example:
export KUBECTL_CF_KUBECONFIG_MATCH_PATTERN="^(?P<name>([^\.]+\.kubeconfig))$"
- Auto completion;
- krew integration;
- Tests;
- kubekraken: kubectl that operates multiple contexts concurrently;
- kubectl-ctx: switch between kubernetes contexts;