Kube Aliases

Kubernetes Aliases and Bash Functions
Alternatives To Kube Aliases
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Victoriametrics8,213411 hours ago174September 08, 2022633apache-2.0Go
VictoriaMetrics: fast, cost-effective monitoring solution and time series database
Pachyderm5,86712 days ago220September 22, 2022913otherGo
Data-Centric Pipelines and Data Versioning
Kube Prometheus5,124
3 days ago27June 17, 2022176apache-2.0Jsonnet
Use Prometheus to monitor Kubernetes and applications running on Kubernetes
Metrics Server4,58663 days ago41February 22, 202231apache-2.0Go
Scalable and efficient source of container resource metrics for Kubernetes built-in autoscaling pipelines.
Pixie4,440
2 days ago88April 24, 2021228apache-2.0C++
Instant Kubernetes-Native Application Observability
Kube State Metrics4,409485 days ago93June 03, 202256apache-2.0Go
Add-on agent to generate and expose cluster-level metrics.
M34,38962 days ago994April 07, 2022206apache-2.0Go
M3 monorepo - Distributed TSDB, Aggregator and Query Engine, Prometheus Sidecar, Graphite Compatible, Metrics Platform
Flagger4,1667a day ago48August 29, 2022224apache-2.0Go
Progressive delivery Kubernetes operator (Canary, A/B Testing and Blue/Green deployments)
Serve3,2651113 hours ago14May 13, 2022247apache-2.0Java
Serve, optimize and scale PyTorch models in production
Hubble2,58842 days ago42June 22, 202230apache-2.0Go
Hubble - Network, Service & Security Observability for Kubernetes using eBPF
Alternatives To Kube Aliases
Select To Compare


Alternative Project Comparisons
Readme

kube-aliases

This is an oh-my-zsh plugin (or source kube-aliases.plugin.zsh for bash) to make working with kubernetes easier. It provides a bunch of bash aliases and zsh functions. Docs can be found here, which clarifies all aliases.

Usage

There are a few main features of this plugin. First, there are lots of aliases to make working with Kubernetes easier. Second, there are bash functions to help with varies tasks such as switching contexts to use different clusters.

Aliases

To see a full list of aliases, use

khelp usage

In general and when it makes sense, aliases follow the following conventions.

k           # kubectl
kd<r>       # kubectl delete <resource>, e.g. kdp for kubectl delete pods
kds<r>      # kubectl describe <resource>, e.g. kdsp for kubectl describe pod
ke<r>       # kubectl edit <resource>, e.g. kep for kubectl edit pods
kg<r>       # kubectl get <resource>, e.g. kgp for kubectl get pods
kga<r>      # kubectl get --all-namespaces -o wide <resource>, e.g. kgap for kubectl --all-namespaces -o wide get pods
kl          # kubectl logs <podname>
klf         # kubectl logs -f <podname>: i.e. watch logs live

There is also some other useful commands such as the following:

kcon       # create configuration files
kdap       # delete all pods within a namespace
kdrain     # drain a node
kexec      # execute a command in a specified pod,
           # default drops user into a shell
kfind      # use a regular expression to find items across everything except
           # custom resources
kgpns      # Get just pod names in a namespace
kpfind     # Search through pods with regular expressions
krd        # restart a deployment
kstatus    # search across namespaces to find pods statuses

For a more detailed list of aliases, view the docs.

Not everything is currently implemented, but more and more is being added to the list. If something is missing that is desired, feel free to submit a pull request.

Installation

Oh-My-Zsh

git clone https://github.com/Dbz/kube-aliases.git ~/.oh-my-zsh/custom/plugins/kube-aliases
echo "plugins+=(kube-aliases)" >> ~/.zshrc

You can also manually place kube-aliases inside of plugins=(...)

If you have set the ZSH_CUSTOM environment variable in your zshrc, then you should modify the git clone directory to be $ZSH_CUSTOM/plugins/kube-aliases.

Antigen

Add antigen bundle dbz/kube-aliases to your antigen bundles in your .zshrc

Zgen

Add zgen load dbz/kube-aliases to your zgen plugins in your .zshrc

Zinit

Add zinit load Dbz/kube-aliases to your zinit plugins in your .zshrc

Bash

Source kube-aliases.plugin.zsh in your .bashrc.

Aliases for Kubernetes Extensions

kubectx

For easy context and namespace switching there is kubectx. kubectx allows users context switching, and the linked github comes with kubens which allows for simple namespace switching. You can use the following aliases:

alias kctx='kubectx'
alias kns='kubens'

Kubernetes Metrics Server

To get some metrics from nodes or pods, you can use Kubernetes Metrics Server. There are the aliases

alias kt='kubectl top'
alias ktn='kubectl top nodes'
alias ktp='kubectl top pods'

Trouble Shooting

Autocomplete

If there is problems with autocomplete, it may be that kubectl is not on the path when the plugin is loaded. To fix, load plugins after adding kubectl to path.

Popular Kubernetes Projects
Popular Metrics Projects
Popular Virtualization Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Shell
Kubernetes
Bash
Metrics
Command Line Tool
Zsh
Autocomplete
Kubectl
Oh My Zsh