ensure-kube-context
January 9, 2025 · View on GitHub
A ZSH plugin to ensure the --context flag is passed to various Kubernetes commands like kubectl, cilium, stern, and more.
Install
Oh My Zsh
- Clone the repository:
git clone --depth=1 \
https://github.com/do-i-need-a-username/ensure-kube-context.git \
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/ensure-kube-context
- Configure your .zshrc:
Open ~/.zshrc and set ENSURE_KUBE_CONTEXT_MODULES to a list of commands you want to enforce the --context flag on.
# .zshrc
ENSURE_KUBE_CONTEXT_MODULES=(kubectl cilium stern helm kustomize)
- Enable the plugin:
Add ensure-kube-context to the plugins list in your ~/.zshrc file:
plugins=(... ensure-kube-context)
- Apply changes:
Source your ~/.zshrc file to apply the changes:
source ~/.zshrc
Usage
Once installed and configured, the plugin will automatically ensure that the --context flag is passed to the specified commands.
Contributing
If you’d like to contribute to this project, please fork the repository and create a pull request with your changes.
License
This project is licensed under the MIT License.