KubeKit

Three short commands, k, kc and kn, for switching Kubernetes contexts and namespaces fast.

KubeKit

Managing Kubernetes clusters, contexts, and namespaces can be time-consuming. But fear not! I’ve got you covered with three KubeKit smart tools: k, kc, and kn. These tools will streamline your workflow and make your life easier.

TL;DR

Full KubeKit installation:

curl -sL https://github.com/nh4ttruong/kubekit/raw/main/install.sh | sudo bash -s -- -a

Features

  • k or kubectl: The official kubectl tool made by Official Kubernetes, you also could use k as its short version. They come with intelligent auto-completion! Just hit <TAB> to see the magic happen.
  • kc: Easily to switch between cluster contexts with a shorter alias kc. Type kc instead of the full command to get all contexts with current highlighting context.
  • kn: Need to get all namepsaces or switch between cluster namespaces? No problem! kn is your fast lane.

Installation

To install KubeKit, follow these steps:

  1. Install kubectl only:
curl -sL https://github.com/nh4ttruong/kubekit/raw/main/install.sh | sudo bash
  1. Install kubectl with kc (context) and kn (namespace) aliases operations:
  • Linux (bash):
curl -sL https://github.com/nh4ttruong/kubekit/raw/main/install.sh | sudo bash -s -- -a
  • MacOS (zsh):
curl -sL https://github.com/nh4ttruong/kubekit/raw/main/install.sh | sudo zsh -s -- -a
  1. Manual install from repository:
git clone https://github.com/nh4ttruong/kubekit.git
cd kubekit
bash ./install.sh -a

The -a or --alias option is optional and allows you to install quick aliases for context kc and namespace kn operations.

Usage

Once installed, you can use KubeKit to enhance your Kubernetes workflow:

  • Use k as short version of kubectl:
  • Use kc to manage Kubernetes contexts:
    • kc: List available contexts
    • kc <context-name>: Switch to the specified context
  • Use kn to manage Kubernetes namespaces:
    • kn: List available namespaces
    • kn <namespace-name>: Switch to the specified namespace

For more information on KubeKit usage, refer to run kc -h and kn -h for help.

Reference

Contributing

Contributions are welcome! If you have any suggestions, feature requests, or bug reports, please open an issue or submit a pull request.

More projects

More on GitHub.

Scripts, configs and experiments on github.com/nh4ttruong.