kubectl.plugin.zsh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. if (( $+commands[kubectl] )); then
  2. __KUBECTL_COMPLETION_FILE="${ZSH_CACHE_DIR}/kubectl_completion"
  3. if [[ ! -f $__KUBECTL_COMPLETION_FILE ]]; then
  4. kubectl completion zsh >! $__KUBECTL_COMPLETION_FILE
  5. fi
  6. [[ -f $__KUBECTL_COMPLETION_FILE ]] && source $__KUBECTL_COMPLETION_FILE
  7. unset __KUBECTL_COMPLETION_FILE
  8. fi
  9. # This command is used ALOT both below and in daily life
  10. alias k=kubectl
  11. # Apply a YML file
  12. alias kaf='k apply -f'
  13. # Drop into an interactive terminal on a container
  14. alias keti='k exec -ti'
  15. # Manage configuration quickly to switch contexts between local, dev ad staging.
  16. alias kcuc='k config use-context'
  17. alias kcsc='k config set-context'
  18. alias kcdc='k config delete-context'
  19. alias kccc='k config current-context'
  20. # Pod management.
  21. alias kgp='k get pods'
  22. alias kep='k edit pods'
  23. alias kdp='k describe pods'
  24. alias kdelp='k delete pods'
  25. # Service management.
  26. alias kgs='k get svc'
  27. alias kes='k edit svc'
  28. alias kds='k describe svc'
  29. alias kdels='k delete svc'
  30. # Ingress management
  31. alias kgi='k get ingress'
  32. alias kei='k edit ingress'
  33. alias kdi='k describe ingress'
  34. alias kdeli='k delete ingress'
  35. # Secret management
  36. alias kgsec='k get secret'
  37. alias kdsec='k describe secret'
  38. alias kdelsec='k delete secret'
  39. # Deployment management.
  40. alias kgd='k get deployment'
  41. alias ked='k edit deployment'
  42. alias kdd='k describe deployment'
  43. alias kdeld='k delete deployment'
  44. alias ksd='k scale deployment'
  45. alias krsd='k rollout status deployment'
  46. # Rollout management.
  47. alias kgrs='k get rs'
  48. alias krh='k rollout history'
  49. alias kru='k rollout undo'
  50. # Logs
  51. alias kl='k logs'
  52. alias klf='k logs -f'