kubectl convenience functions. Add . <path>/{bash,zsh}rc
to your shell rc and
export KUBE_NS=your-kubectl-namespace.
Dependencies: kubectl, percol
col N
uses awk to return column N, default 1. col skip N
drops the first
line.
kgg
(k get grep) finds the namespace and name of a pod based on a pattern.
Has --help.
kggc
extends kgg
to match containers. Has --help.
kre
is like k
, but uses kgg
. Useful to abbreviate EG pod names: kre desc
po comm
.
kex
executes a command (sh by default) in a pod. Arguments until the first
-- are passed to kgg
, the remainder are the command.
kexc
is exactly like kex
except that it uses kggc
.
ksql
is basically kex postgres psql
.
kexp
allows you to interactively choose which container to enter.
ksetsecret
uses kube-secret-editor.py
to set values from ~/.ksecretvals
into the given secret (via kgg
). EG if your secret (root-pg-password
) looks
like:
junk... data: foo: b64-encode(wabbadoo) bar: b64-encode(yoink) other junk...
then you can set bar
by having ~/.ksecretvals
:
bar: yeet
And running:
ksetsecret pg
The Python is maintained at https://github.com/lxsli/kube-secret-editor, please push edits there first. It requires Python3 and PyYAML.