Additions and tweaks to the kubectl CLI.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
kubectl-aggregate-status
kubectl-bash
kubectl-completed
kubectl-d
kubectl-evicted
kubectl-get
kubectl-getg
kubectl-getgstat
kubectl-getstat
kubectl-kill
kubectl-modify
kubectl-ns
kubectl-p
kubectl-pcn
kubectl-podcontainerages
kubectl-podcontainernames
kubectl-podcontainerrelativeages
kubectl-podcontainers
kubectl-podhosts
kubectl-podimages
kubectl-podinfo
kubectl-podips
kubectl-podnames
kubectl-recreate
kubectl-remove-completed
kubectl-remove-evicted
kubectl-wait

README.md

kubectl CLI extensions

These are some personal aliases, shortcuts, and extensions that make (my) work with the Kubernetes command-line utility kubectl easier and faster. Some of them may be specific to my environment and workflow, but maybe someone finds a valuable nugget in there.

Installation

Download all / some selected extensions (note that some have dependencies, though) and put them somewhere in your PATH. You can then invoke them via kubectl-SUBCOMMAND.

Optionally, use the following (Bash, but should also work in Korn shell and Dash) shell function (e.g. in your .bashrc) to transparently invoke the extensions in the same way as the built-in kubectl commands, via kubectl SUBCOMMAND:

# Allow definition of Kubectl aliases putting an executable "kubectl-foo"
# somewhere in the PATH.
kubectl() {
    typeset -r kubectlAlias="kubectl-$1"
    if [ $# -eq 0 ]; then
        kubectl ${KUBECTL_DEFAULT_COMMAND:-p}
    elif type ${BASH_VERSION:+-t} "$kubectlAlias" >/dev/null 2>&1; then
        shift
        eval $kubectlAlias '"$@"'
    else
        command kubectl "$@"
    fi
}

Note that Kubernetes also provides its own extension mechanism; these need to provide a YAML plugin descriptor, get command-line arguments already parsed, and are invoked through kubectl plugin PLUGIN-COMMAND. I don't intend to convert mine into that format, because parsing effort is minimal, and I prefer to seamlessly blend in with (or even override) built-in subcommands.