Skip to content

Custom kubectl or OpenShift CLI

Sometimes, you may want to specify which command to use as kubectl internally in kubecolor. For example, when you want to use a versioned-kubectl kubectl.1.19, you can do that by an environment variable or config field:

Terminal window
export KUBECTL_COMMAND="kubectl.1.19"

The config defaults to kubectl.

OpenShift

This feature can be used to use kubecolor with the OpenShift CLI (oc) as well:

Terminal window
export KUBECTL_COMMAND="oc"

Then you can set oc to be an alias for kubecolor:

~/.bashrc
alias oc="kubecolor"

Alternatively, instead of using the config, you can set the oc alias to also set the environment variable:

~/.bashrc
alias oc="env KUBECTL_COMMAND=oc kubecolor"