A kubectl
wrapper for Infinite Monkeys randomly rewriting the Internet.
Actually, a lightweight Bash script that provides shorthand aliases for kubectl
commands, resources, and options.
It saves you a ton of typing — and maybe even a few keystroke-induced rage quits.
You can download it, add it to your $PATH
, or alias it directly in your shell config.
➡️ Check the script itself for the full list of supported aliases.
$ k g po -W -n ks
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
coredns-76f75df574-gdkxc 1/1 Running 2 (13m ago) 114m 10.88.0.6 cp0 <none> <none>
...
$ k g no -N
node/cp0
...
I prefer using watch -n1
over the default --watch
, so there's a special alias just for that:
$ k w g po -n ks
Every 1.0s: kubectl get pods --namespace kube-system
NAME READY STATUS RESTARTS AGE
coredns-76f75df574-dmhwv 1/1 Running 0 2m11s
etcd-cp0 1/1 Running 0 2m11s
...
Use w
at the beginning of your command and it'll auto-wrap with watch -n1
.
You can extend k
with your own custom aliases for things like:
- Kubernetes contexts (
-x
) - Namespaces (
-n
) - Resource types or CRDs
- Shorthand commands
Just create a file at:
~/.kmap.custom
Use simple key=value
pairs, one per line:
# ~/.kmap.custom
# Context aliases
mlc=my-local-cluster
gcc=google-cloud-cluster
mwc=microsoft-windows-cluster
# Custom resources
db=databases.mycompany.io
svc=services
# Namespace shortcuts
ks=kube-system
df=default
These entries are automatically loaded every time k
runs — no restart or reload required.
$ k -x mlc g po -n df -W
kubectl --context my-local-cluster get pods --namespace default -o wide
...
You can modify the file at any time to add or change aliases. It's your own kubectl
booster pack.
Fork it. Copy it. Bash it. Rewrite it in Rust if you want.
If your customizations might be useful to others, feel free to open an issue or submit a pull request.
This project is licensed under The Unlicense — public domain, no strings attached.