Skip to content
/ kx Public

set KUBECONFIG environment variable for current shell session

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

jsen-/kx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kx

Changes KUBECONFIG environment variable in the current shell

Installation

You can either download compiled binary from releases to a directory in you $PATH or compile it yourself by cargo install k8s-kx. Binaries in releases are build using musl toolchain, therefore they have no external dependencies (not even libc).

Add the following to your .bashrc

kx() {
    eval $(k8s-kx)
}

Usage

$ kx

Configuration

  • $KX_SEARCH_DIR will let you choose KUBECONFIG from this directory
  • $KX_CONFIG_PATH will read configuration from this file (format below)
  • $XDG_CONFIG_HOME/kx/config.json
  • ~/.config/kx/config.json
  • if none of them are found, will search for kubeconfigs in ~/.kube

Config file format

{
    "search_dir": [
        // absolute path
        "/path/to/dir/with/cubeconfigs",
        // will be resolved relative to $PWD
        "path/to/cubeconfigs", 
        // will be resolved relative to this config file
        "./path/to/cubeconfigs",
        // will be resolved relative to home directory
        "~/path/to/cubeconfigs",
        // will try to find first existing directory:
        //   $PWD/path/to/cubeconfigs
        //   $PWD/../path/to/cubeconfigs
        //   $PWD/../../path/to/cubeconfigs
        //   ...
        //   /path/to/cubeconfigs
        "^path/to/cubeconfigs",
    ]
}

About

set KUBECONFIG environment variable for current shell session

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages