Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/particledecay/kconf
Manage multiple kubeconfigs easily
https://github.com/particledecay/kconf
Last synced: 4 months ago
JSON representation
Manage multiple kubeconfigs easily
- Host: GitHub
- URL: https://github.com/particledecay/kconf
- Owner: particledecay
- License: mit
- Created: 2020-01-14T05:56:51.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-11-29T22:26:38.000Z (about 1 year ago)
- Last Synced: 2024-08-19T00:41:25.865Z (4 months ago)
- Language: Go
- Homepage:
- Size: 176 KB
- Stars: 118
- Watchers: 2
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
kconf
An opinionated command line tool for managing multiple kubeconfigs.
## Description
kconf works by storing all kubeconfig information in a single file (`$HOME/.kube/config`). This file is looked at by default when using `kubectl`.
## Usage
##### Add in a new kubeconfig file:
```sh
kconf add /path/to/kubeconfig.conf
```or
```sh
kconf add /path/to/kubeconfig.conf --context-name=myContext
```##### Remove an existing kubeconfig:
```sh
kconf rm myContext
```##### List all saved contexts in the kubeconfig:
```sh
kconf ls
```##### View and print a single context's kubeconfig (you can pipe or export to a file):
```sh
kconf view myContext
```##### Switch to an existing context:
```sh
kconf use myContext
```##### Set a preferred namespace
```sh
kconf use myContext -n my-namespace
```or
```sh
kconf ns my-namespace
```## Why?
I was previously managing my kubeconfigs using the `$KUBECONFIG` environment variable. However, in order to automate this process, you have to do something like this in your rc files:
```bash
KUBECONFIG=$(find $HOME/.kube -type f -name '*.conf' 2> /dev/null | sed ':a;N;$!ba;s/\n/:/g')
```... that gets you a `$KUBECONFIG` variable with all your kubeconfigs separated by colons. The problem is that if you're frequently working with new/modified kubeconfigs, you'd have to trigger this command each time something changed.
With the `kconf` command, there's no need for `$KUBECONFIG` since `kubectl` already looks at `$HOME/.kube/config` by default. Additionally, as soon as you have a new kubeconfig, you can `add` it pretty easily and quickly.
## Known Issues
Check out the [Issues](https://github.com/particledecay/kconf/issues) section or specifically [issues created by me](https://github.com/particledecay/kconf/issues?q=is:issue+is:open+sort:updated-desc+author:particledecay)