kubectl.plugin.zsh 1.78 KB
Newer Older
1
2
if (( $+commands[kubectl] )); then
    __KUBECTL_COMPLETION_FILE="${ZSH_CACHE_DIR}/kubectl_completion"
Patrick Stadler's avatar
Patrick Stadler committed
3

4
5
6
    if [[ ! -f $__KUBECTL_COMPLETION_FILE ]]; then
        kubectl completion zsh >! $__KUBECTL_COMPLETION_FILE
    fi
7

8
    [[ -f $__KUBECTL_COMPLETION_FILE ]] && source $__KUBECTL_COMPLETION_FILE
9

10
    unset __KUBECTL_COMPLETION_FILE
Patrick Stadler's avatar
Patrick Stadler committed
11
fi
12

Shawn Milochik's avatar
Shawn Milochik committed
13
# This command is used a LOT both below and in daily life
14
15
alias k=kubectl

16
# Apply a YML file
17
alias kaf='kubectl apply -f'
18

19
# Drop into an interactive terminal on a container
20
alias keti='kubectl exec -ti'
21
22

# Manage configuration quickly to switch contexts between local, dev ad staging.
23
24
25
26
alias kcuc='kubectl config use-context'
alias kcsc='kubectl config set-context'
alias kcdc='kubectl config delete-context'
alias kccc='kubectl config current-context'
27
28

# Pod management.
29
30
31
32
alias kgp='kubectl get pods'
alias kep='kubectl edit pods'
alias kdp='kubectl describe pods'
alias kdelp='kubectl delete pods'
33
34

# Service management.
35
36
37
38
alias kgs='kubectl get svc'
alias kes='kubectl edit svc'
alias kds='kubectl describe svc'
alias kdels='kubectl delete svc'
39

40
# Ingress management
41
42
43
44
alias kgi='kubectl get ingress'
alias kei='kubectl edit ingress'
alias kdi='kubectl describe ingress'
alias kdeli='kubectl delete ingress'
45

46
# Secret management
47
48
49
alias kgsec='kubectl get secret'
alias kdsec='kubectl describe secret'
alias kdelsec='kubectl delete secret'
50
51

# Deployment management.
52
53
54
55
56
57
alias kgd='kubectl get deployment'
alias ked='kubectl edit deployment'
alias kdd='kubectl describe deployment'
alias kdeld='kubectl delete deployment'
alias ksd='kubectl scale deployment'
alias krsd='kubectl rollout status deployment'
58
59

# Rollout management.
60
61
62
alias kgrs='kubectl get rs'
alias krh='kubectl rollout history'
alias kru='kubectl rollout undo'
63
64

# Logs
65
66
alias kl='kubectl logs'
alias klf='kubectl logs -f'