Thanks to visit codestin.com
Credit goes to github.com

Skip to content

kadirbelkuyu/kubecfg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kubecfg

A CLI tool for managing Kubernetes kubeconfig files.

kubecfg demo

Installation (Coming soon for package managers)

Homebrew

brew tap kadirbelkuyu/tap
brew install kadirbelkuyu/tap/kubecfg

Krew

kubectl krew install kubecfg

Go

go install github.com/kadirbelkuyu/kubecfg@latest

From Source

git clone https://github.com/kadirbelkuyu/kubecfg.git
cd kubecfg
go build -o kubecfg .
sudo mv kubecfg /usr/local/bin/
More installation options

Arch Linux (AUR)

yay -S kubecfg

MacPorts

sudo port install kubecfg

Chocolatey (Windows)

choco install kubecfg

Winget (Windows)

winget install kadirbelkuyu.kubecfg

APT (Debian/Ubuntu)

curl -fsSL https://kadirbelkuyu.github.io/apt-repo/public_key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/kubecfg-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/kubecfg-keyring.gpg] https://kadirbelkuyu.github.io/apt-repo stable main" | sudo tee /etc/apt/sources.list.d/kubecfg.list
sudo apt update && sudo apt install kubecfg

Features

  • Add - Import kubeconfig files with custom context names
  • List - View all contexts with cluster details
  • Use - Interactive context switching with optional namespace selection
  • Namespace - Switch namespaces with interactive picker
  • Remove - Delete contexts with confirmation
  • Rename - Change context names
  • Merge - Combine multiple kubeconfig files

Usage

Add a Cluster

kubecfg add ./eks-cluster.yaml --name production-eks

List Contexts

kubecfg list

Switch Context

Interactive mode:

kubecfg use

Direct switch:

kubecfg use production-eks

With interactive namespace selection:

kubecfg use -n
kubecfg use production-eks -n

With specific namespace:

kubecfg use production-eks -n kube-system

Switch Namespace

Interactive mode:

kubecfg ns

Direct switch:

kubecfg ns kube-system

Show current namespace:

kubecfg ns current

Show Current Context

kubecfg current

Rename Context

kubecfg rename old-name new-name

Remove Context

kubecfg remove old-cluster
kubecfg remove old-cluster --force  # skip confirmation

Merge Configs

kubecfg merge config1.yaml config2.yaml -o merged.yaml

Flags

Flag Description
--kubeconfig Path to kubeconfig file (default: ~/.kube/config)
-n, --namespace Set namespace for context (use without value for interactive selection)

License

MIT License

About

A fast, secure CLI tool for managing Kubernetes kubeconfig files.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages