All Projects → dty1er → Kubecolor

dty1er / Kubecolor

Licence: mit
colorizes kubectl output

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Kubecolor

openebsctl
`openebsctl` is a kubectl plugin to manage OpenEBS storage components.
Stars: ✭ 23 (-93.66%)
Mutual labels:  kubectl
kubectl-gs
kubectl plugin helping with custom resources by Giant Swarm
Stars: ✭ 36 (-90.08%)
Mutual labels:  kubectl
Kubedog
Library to watch and follow kubernetes resources in CI/CD deploy pipelines
Stars: ✭ 326 (-10.19%)
Mutual labels:  kubectl
vcluster
vcluster - Create fully functional virtual Kubernetes clusters - Each vcluster runs inside a namespace of the underlying k8s cluster. It's cheaper than creating separate full-blown clusters and it offers better multi-tenancy and isolation than regular namespaces.
Stars: ✭ 1,360 (+274.66%)
Mutual labels:  kubectl
KuiClientTemplate
Use this template to make your own custom graphical terminal, via the Kui Grahpical CLI Framework
Stars: ✭ 26 (-92.84%)
Mutual labels:  kubectl
Kubectl Node Shell
Exec into node via kubectl
Stars: ✭ 277 (-23.69%)
Mutual labels:  kubectl
kube-s
A lightweight CLI for quickly finding specific k8s resources (by pattern matching Names) across all clusters available to kubectl.
Stars: ✭ 23 (-93.66%)
Mutual labels:  kubectl
Rak8s
Stand up a Raspberry Pi based Kubernetes cluster with Ansible
Stars: ✭ 354 (-2.48%)
Mutual labels:  kubectl
kubectl-view-webhook
👀 ‼️ This projects aims to visualize critical parts of the admission webhook configuration resource
Stars: ✭ 96 (-73.55%)
Mutual labels:  kubectl
Kubectl Fzf
A fast kubectl autocompletion with fzf
Stars: ✭ 315 (-13.22%)
Mutual labels:  kubectl
forward
🎳 forward - extended kubectl port-forward - reliable multiple port forwarding.
Stars: ✭ 17 (-95.32%)
Mutual labels:  kubectl
zsh-kubectl-completion
Rich zsh completion for the kubectl command.
Stars: ✭ 35 (-90.36%)
Mutual labels:  kubectl
Awesome Kubectl Plugins
Curated list of kubectl plugins
Stars: ✭ 279 (-23.14%)
Mutual labels:  kubectl
kubesort
`KUBESORT` simplified sorting for kubectl
Stars: ✭ 43 (-88.15%)
Mutual labels:  kubectl
Zsh Kubectl Prompt
Display information about the kubectl current context and namespace in zsh prompt.
Stars: ✭ 342 (-5.79%)
Mutual labels:  kubectl
kubectl-images
🕸 Show container images used in the cluster.
Stars: ✭ 153 (-57.85%)
Mutual labels:  kubectl
Allok8
⚡️A pretty swell Kubernetes visualization tool
Stars: ✭ 281 (-22.59%)
Mutual labels:  kubectl
Krew
📦 Find and install kubectl plugins
Stars: ✭ 4,354 (+1099.45%)
Mutual labels:  kubectl
Kubectl Plugins
A Collection of Plugins for kubectl Integration (exec as any user, context switching, etc).
Stars: ✭ 340 (-6.34%)
Mutual labels:  kubectl
Kubetap
Kubectl plugin to interactively proxy Kubernetes Services with ease
Stars: ✭ 297 (-18.18%)
Mutual labels:  kubectl

kubecolor

test Go Report Card codecov

Colorize your kubectl output

  • get pods

image

  • describe pods

image

  • something wrong

image

  • You can change color theme for light-backgrounded environment

image

What's this?

kubecolor colorizes your kubectl command output and does nothing else. kubecolor internally calls kubectl command and try to colorizes the output so you can use kubecolor as a complete alternative of kubectl. It means you can write this in your .bash_profile:

alias kubectl="kubecolor"

If you use your .bash_profile on more than one computer (e.g. synced via git) that might not all have kubecolor installed, you can avoid breaking kubectl like so:

command -v kubecolor >/dev/null 2>&1 && alias kubectl="kubecolor"

kubecolor is developed to colorize the output of only READ commands (get, describe...). So if the given subcommand was for WRITE operations (apply, edit...), it doesn't give great decorations on it.

For now, not all subcommands are supported and will be done in the future. What is supported can be found below. Even if what you want to do is not supported by kubecolor now, kubecolor still can just show kubectl output without any decorations, so you don't need to switch kubecolor and kubectl but you always can use kubecolor.

Additionally, if kubectl resulted an error, kubecolor just shows the error message in red or yellow.

Installation

Mac and Linux users via Homebrew

brew install dty1er/tap/kubecolor

Manually via go command

go install github.com/dty1er/kubecolor/cmd/[email protected]

If you are not using module mode (or if just above doesn't work), try below:

go get -u github.com/dty1er/kubecolor/cmd/kubecolor

Usage

kubecolor understands every subcommands and options which are available for kubectl. What you have to do is just using kubecolor instead of kubectl like:

kubecolor --context=your_context get pods -o json

If you want to make the colorized kubectl default on your shell, just add this line into your shell configuration file:

alias kubectl="kubecolor"

Flags

  • --plain

When you don't want to colorize output, you can specify --plain. Kubecolor understands this option and outputs the result without colorizing. Of course, given --plain will never be passed to kubectl. This option will help you when you want to save the output onto a file and edit them by editors.

  • --light-background

When your terminal's background color is something light (e.g white), default color preset might look too bright and not readable. If so, specify --light-background as a command line argument. kubecolor will use a color preset for light-backgrounded environment.

  • --force-colors

By default, kubecolor never output the result in colors when the tty is not a terminal. If you want to force kubecolor to show the result in colors for non-terminal tty, you can specify this flag. For example, when you want to pass kubecolor result to grep (kubecolor get pods | grep pod_name), this option is useful.

Autocompletion

kubectl provides autocompletion feature. If you are already using it, you might have to configure it for kubecolor. Please also refer to kubectl official doc for kubectl autorcomplete.

Bash

For Bash, configuring autocompletion requires adding following line in your shell config file.

# autocomplete for kubecolor
complete -o default -F __start_kubectl kubecolor

If you are using an alias like k="kubecolor", then just change above like:

complete -o default -F __start_kubectl k

Zsh

For zsh make sure these lines are present in your zsh config file:

# get zsh complete kubectl
source <(kubectl completion zsh)
alias kubectl=kubecolor
# make completion work with kubecolor
compdef kubecolor=kubectl

fish

Fish completion is officially unsupported by kubectl, so it is unsupported by kubecolor as well.

However, there are 2 ways we can make them work. Please keep in mind these are a kind of "hack" and not officially supported.

  1. Use evanlucas/fish-kubectl-completions with kubecolor:

  2. Use awinecki/fish-kubecolor-completions

    The first way will override kubectl command. If you wish to preserve both kubectl and kubecolor with completions, you need to copy evanlucas/fish-kubectl-completions for the kubecolor command.

    For this purpose, you can use awinecki/fish-kubecolor-completions.

Specify what command to execute as kubectl

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:

KUBECTL_COMMAND="kubectl.1.19" kubecolor get po

When you don't set KUBECTL_COMMAND, then kubectl is used by default.

Supported kubectl version

Because kubecolor internally calls kubectl command, if you are using unsupported kubectl version, it's also not supported by kubecolor. Kubernetes version support policy can be found in official doc.

Contributions

Always welcome. Just opening an issue should be also greatful.

LICENSE

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].