Skip to content

A kubectl plugin that makes kubectl smart with name search.Type less letters!Save more life!

License

Notifications You must be signed in to change notification settings

FingerLiu/kubectl-smart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

kubectl-smart

A kubectl plugin that makes kubectl smart with name search.Type less letters!Save more life! demo

Installation

using curl:

curl -LO https://github.com/FingerLiu/kubectl-smart/raw/main/kubectl-smart
chmod +x ./kubectl-smart
sudo mv ./kubectl-smart /usr/local/bin/kubectl-smart
kubectl smart -h

using krew:

TODO
kubectl smart -h

Usage

USAGE:
  smart sub_command [options...] [name_pattern...]
SUB_COMMAND:
  gp                        : shortcut for get pod
  l,logs                    : shortcut for logs
  e,exec                    : shortcut for exec
  edp                       : shortcut for edit pod
  ed,edit                   : shortcut for edit
  dp                        : shortcut for delete pod
  g                         : shortcut for get
  h,help                    : show this message
OPTIONS:
  -n                        : namespace
  -w,--wide                 : TODO get with wide output
  -f,--follow               : follow log output
  --tail                    : tail logs
  -t                        : --tty=true: Stdin is a TTY
  -i                        : --stdin=true: Pass stdin to the container
  -s                        : sort by create datetime
  -c                        : TODO container name.
  -e                        : use exact match rather than grep. Only use this when you want to disable grep when grep return multi items.
Examples:
  # if you installed through krew, you should **kubectl smart** to replace **kubectl s**
  # get pod with name contains my in namespace her-namespace
  # (kubectl get pod -n her-namespace-a |grep my)
  kubectl smart gp -n her.*a my

  # get log for pod with name my
  # (kubectl logs --tail 100 -f $(kubectl get pods | awk '/my/ {print $1;exit}'))
  kubectl smart l my

  # exec into pod
  # kubectl exec -ti my-pod-i3jx bash
  kubectl smart e my bash

  # get deploy with name contains my
  # (kubectl get deploy | grep my)
  kubectl smart g deploy my
  
  alias k=`kubectl smart`
  
  # get pod with ascending sort 
  # --sort-by=.metadata.creationTimestamp
  k gp my -s

  # get pod with descending sort 
  # --sort-by=.metadata.creationTimestamp
  k gp my -s | tac

About

A kubectl plugin that makes kubectl smart with name search.Type less letters!Save more life!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages