This tool provides a simple command line interface to manage your KUBECONFIG environment variable. It allows you to display the content of the KUBECONFIG file, unset the KUBECONFIG environment variable, select a KUBECONFIG file from the ~/.kube directory, and set the KUBECONFIG environment variable to a provided file.
-
Clone the repository:
git clone git@github.com:anatoly-cnvrg/zsh_scripts.git cd k8s-tool -
Make the script executable:
chmod +x k8s.sh
-
Add the script to your path. This can be done by editing the
.zshrcfile in your home directory. You can use any text editor you like, but here's an example usingvim:vim ~/.zshrcThen add the following line at the end of the file:
source /path/to/your/script/k8s.shReplace
/path/to/your/script/with the actual path where thek8s.shscript is located. -
Reload your
.zshrc:source ~/.zshrc
Now, you should be able to use the
k8scommand from any directory.
To display the content of the KUBECONFIG file:
k8s -dTo unset the KUBECONFIG environment variable:
k8s -uTo select a KUBECONFIG file from the ~/.kube directory:
k8s -sTo set the KUBECONFIG environment variable to a provided file:
k8s /path/to/your/kubeconfigTo select a KUBECONFIG file from the ~/.kube directory and run k9s with it without changing the KUBECONFIG environment variable:
k8s -r
For help:
k8s -hThis will display the usage and available options.
Similar to k8s.sh but for managing TALOSCONFIG environment variable and running talosctl dashboard.
Add to your .zshrc:
source ~/.zsh_scripts/t8s.shTo select a talosconfig and run dashboard:
t8sTo select a talosconfig from ~/.talos directory:
t8s -sTo display the content of the TALOSCONFIG file:
t8s -dTo display the path of the TALOSCONFIG file:
t8s -eTo unset the TALOSCONFIG environment variable:
t8s -uTo set TALOSCONFIG to a specific file:
t8s /path/to/your/talosconfigFor help:
t8s -h