Skip to content
konfig helps to merge, split or import kubeconfig files
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Latest GitHub release Travis (.org) branch Written in Bash

konfig helps to merge, split or import kubeconfig files


Import a kubeconfig

konfig import --save new-cfg

Imports the config file new-cfg into the default kubeconfig at ~/.kube/config. To show the result without changing your kubeconfig, do

konfig import new-cfg

CAVEAT: due to how shells work, the following will lose your current ~/.kube/config

# WRONG, don't do this!
konfig import new-cfg > ~/.kube/config

Merge several kubeconfig files

konfig merge config1 config2 > merged-config

This variant creates a self-contained kubeconfig where all credentials are stored inline in the kubeconfig. If you want to preserve the structure and keep credentials separate, use --preserve-structure.

Extract a minimal kubeconfig for one or several contexts

This will extract a minimal kubeconfig with a single context minikube:

# extract context minikube from the default kubeconfig
konfig extract minikube > minikube.config

# extract context minikube and docker-for-desktop from two input configs
konfig extract minikube docker-for-desctop -k ~/.kube/other,~/dockercfg > local


There are several ways to install konfig. The recommended installation method is via krew.

Via krew

Krew is the kubectl plugin manager. If you have not yet installed krew, get it at Then installation is as simple as

kubectl krew install konfig

The plugin will be available as kubectl konfig, see doc/USAGE for further details.


When using the binaries for installation, also have a look at USAGE.

OSX & Linux

curl -Lo konfig \
  chmod +x konfig && sudo mv -i konfig /usr/local/bin

Feel free to change the sudo mv to put konfig in some other location from your $PATH variable.


Download konfig and put it in your PATH as konfig.exe.

You can’t perform that action at this time.