# Alias to simplify kubernetes operation

**URL:** <https://discuss.kubernetes.io/t/alias-to-simplify-kubernetes-operation/12514>\
**Category:** General Discussions\
**Created:** [August 21, 2020, 7:54pm UTC](https://discuss.kubernetes.io/t/alias-to-simplify-kubernetes-operation/12514 "2020-08-21T19:54:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![phhuang](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/phhuang/32/5733_2.png) [@phhuang](https://discuss.kubernetes.io/u/phhuang)\
**Post date:** [August 21, 2020, 7:54pm UTC](https://discuss.kubernetes.io/t/alias-to-simplify-kubernetes-operation/12514/1 "2020-08-21T19:54:58Z")

</div>

alias kgp=“kubectl get pods”

alias kgd=“kubectl get deploy”

alias kgs=“kubectl get service”

alias kgn=“kubectl get nodes”

alias kcf=“kubectl create -f”

alias kc=“kubectl”

alias kdp=“kubectl describe pods”

alias kdd=“kubectl describe deploy”

alias kds=“kubectl describe service”

alias kdn=“kubectl describe nodes”

alias kcd=“kubectl create deploy”

alias kdep=“kubectl delete pod”

alias kded=“kubectl delete deploy”

alias ked=“kubectl edit deploy”

alias kep=“kubectl edit pod”

alias kes=“kubectl edit service”

alias kcctx=“kubectl config current-context”

alias kcutx=“kubectl config use-context”

alias kcgtx=“kubectl config get-context”

---

<div class="post-metadata">

**Author:** ![Rene](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/rene/32/11215_2.png) [@Rene](https://discuss.kubernetes.io/u/Rene)\
**Post date:** [November 21, 2022, 6:58am UTC](https://discuss.kubernetes.io/t/alias-to-simplify-kubernetes-operation/12514/2 "2022-11-21T06:58:55Z")

</div>

Those are a lot of aliases.

I use the following set ( which also include some other settings,that can also be found elsewhere ) :

```auto
cat << EOF > ~/.bash_aliases
alias k="kubetcl"
alias kr="kubectl run"
alias kc="kubectl create"
alias ka="kubectl apply -f"
alias kf="kubectl replace --force -f"
alias kd="kubectl describe"
alias kg="kubectl get"
alias ku="kubectl config use-context"
alias vi="vim"
EOF

cat << EOF >> ~/.bashrc
export do="--dry-run=client -o yaml"
EOF

cat << EOF > ~/.vimrc
syntax on
filetype plugin indent on
set ts=2
set sw=2
set et
set ai
EOF

```

---

<div class="post-metadata">

**Author:** ![f00ty1sgreat](https://avatars.discourse-cdn.com/v4/letter/f/3be4f8/32.png) [@f00ty1sgreat](https://discuss.kubernetes.io/u/f00ty1sgreat)\
**Post date:** [January 29, 2023, 11:51pm UTC](https://discuss.kubernetes.io/t/alias-to-simplify-kubernetes-operation/12514/3 "2023-01-29T23:51:53Z")

</div>

I use a couple of functions too -

alias k=kubectl  
alias kn=‘kubectl config set-context --current --namespace’  
alias gn=‘cat .kube/config | grep namespace’  
alias kg=‘k get’  
alias kgd=‘k get deploy -o wide’  
alias kgp=‘k get pods -o wide’  
alias kgpw=‘k get pods -o wide --watch’  
alias kgpa=‘k get pods -o wide -A’  
alias kgn=‘k get nodes -o wide’  
alias kgs=‘k get svc -o wide’  
alias kge=‘k get events --sort-by=’.metadata.creationTimestamp’ | tail -8’  
alias ked=‘k edit deploy’  
alias kep=‘k edit pods’  
alias ken=‘k edit nodes’  
alias kes=‘k edit svc’  
alias kc=‘k create’  
alias kd=‘k describe’  
alias kdelp=‘k $now delete po’  
alias kdel=‘k delete’  
alias ke=‘k edit’  
alias kdd=‘k describe deploy’  
alias kdp=‘k describe pods’  
alias kdn=‘k describe nodes’  
alias kds=‘k describe svc’  
alias krf=‘k replace --force -f’  
alias krpf=‘k replace $now -f’  
alias kcf=‘k create -f’  
krp() { kubectl run $1 --image=$2 $do;}  
kcd() { kubectl create deploy $1 --image=$2 $do;}  
export nks=‘-n kube-system’  
export do=’ --dry-run=client -o yaml’  
export now=’ --force --grace-period=0’  
export rb=‘rolebinding’  
export crb=‘clusterrolebinding’

---

<div class="post-metadata">

**Author:** ![mrbobbytables](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/mrbobbytables/32/7_2.png) [@mrbobbytables](https://discuss.kubernetes.io/u/mrbobbytables)\
**Post date:** [January 30, 2023, 11:50am UTC](https://discuss.kubernetes.io/t/alias-to-simplify-kubernetes-operation/12514/4 "2023-01-30T11:50:34Z")

</div>


