kubectl.plugin.zsh 1.8 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 a LOT both below and in daily life
  10. alias k=kubectl
  11. # Apply a YML file
  12. alias kaf='kubectl apply -f'
  13. # Drop into an interactive terminal on a container
  14. alias keti='kubectl exec -ti'
  15. # Manage configuration quickly to switch contexts between local, dev ad staging.
  16. alias kcuc='kubectl config use-context'
  17. alias kcsc='kubectl config set-context'
  18. alias kcdc='kubectl config delete-context'
  19. alias kccc='kubectl config current-context'
  20. # Pod management.
  21. alias kgp='kubectl get pods'
  22. alias kep='kubectl edit pods'
  23. alias kdp='kubectl describe pods'
  24. alias kdelp='kubectl delete pods'
  25. # Service management.
  26. alias kgs='kubectl get svc'
  27. alias kes='kubectl edit svc'
  28. alias kds='kubectl describe svc'
  29. alias kdels='kubectl delete svc'
  30. # Ingress management
  31. alias kgi='kubectl get ingress'
  32. alias kei='kubectl edit ingress'
  33. alias kdi='kubectl describe ingress'
  34. alias kdeli='kubectl delete ingress'
  35. # Secret management
  36. alias kgsec='kubectl get secret'
  37. alias kdsec='kubectl describe secret'
  38. alias kdelsec='kubectl delete secret'
  39. # Deployment management.
  40. alias kgd='kubectl get deployment'
  41. alias ked='kubectl edit deployment'
  42. alias kdd='kubectl describe deployment'
  43. alias kdeld='kubectl delete deployment'
  44. alias ksd='kubectl scale deployment'
  45. alias krsd='kubectl rollout status deployment'
  46. # Rollout management.
  47. alias kgrs='kubectl get rs'
  48. alias krh='kubectl rollout history'
  49. alias kru='kubectl rollout undo'
  50. # Logs
  51. alias kl='kubectl logs'
  52. alias klf='kubectl logs -f'