目 录CONTENT

文章目录

Kubernetes 命令别名缩写

邱少羽梦
2022-12-09 / 0 评论 / 0 点赞 / 187 阅读 / 1724 字 / 正在检测是否收录...
温馨提示:
本文最后更新于 2024-04-20,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。
  • 创建 .kubectl_aliases 别名文件,脚本下载: wget https://githubcdn.qiushaocloud.top/gh/qiushaocloud/cdn-static/k8s/.kubectl_aliases_qiu -O ~/.kubectl_aliases
alias k='kubectl'

# 切换命名空间
alias kcd='kubectl config set-context $(kubectl config current-context) --namespace'

alias kg='kubectl get'
alias kgpo='kubectl get pods'
alias kgdep='kubectl get deployment'
alias kgcm='kubectl get configmap'
alias kgsvc='kubectl get service'
alias kgns='kubectl get namespaces'
alias kgno='kubectl get nodes'
alias kgposl='kubectl get pods --show-labels'
alias kgsvcoyaml='kubectl get service -o=yaml'
alias kgsvcwn='kubectl get service --watch --namespace'
alias kgsvcslwn='kubectl get service --show-labels --watch --namespace'

alias kd='kubectl describe'
alias kdno='kubectl describe nodes'
alias kdsvc='kubectl describe service'
alias kdns='kubectl describe namespaces'

alias krm='kubectl delete'
alias krmf='kubectl delete -f'
alias krmpo='kubectl delete pods'
alias krmsvc='kubectl delete service'
alias krmcm='kubectl delete configmap'
alias krmns='kubectl delete namespaces'
alias krmdep='kubectl delete deployment'

alias ka='kubectl apply --recursive -f'

alias kex='kubectl exec -i -t'
  • 更详细的别名文件下载地址: wget https://githubcdn.qiushaocloud.top/gh/qiushaocloud/cdn-static/k8s/.kubectl_aliases -O ~/.kubectl_aliases ,文件来源:https://github.com/ahmetb/kubectl-aliases

  • 使用别名文件,在您的系统的 .bashrc/.zshrc 文件中 添加 [ -f ~/.kubectl_aliases ] && source ~/.kubectl_aliases

    image-20220127181133904

0
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin
  3. QQ打赏

    qrcode qq

评论区