当前位置:网站首页>一些实用、常用、效率越来越高的 Kubernetes 别名
一些实用、常用、效率越来越高的 Kubernetes 别名
2022-07-27 08:52:00 【进击云原生】
在本文中,我将与您分享一些别名,这些别名将显着加快您与 K8s 的交互。
文章末尾可以直接复制粘贴相关命令。

以下是我使用过并很有用的别名……
这个命令在下面和日常生活中都被大量使用。

对所有命名空间执行kubectl 命令

应用 YML 文件

放入容器上的交互式终端

快速管理配置以在本地、开发广告登台之间切换上下文

列出所有上下文

删除或强制删除

豆荚管理。

按标签获取 pod

通过命名空间获取 pod

服务管理。

入口管理

ConfigMap 管理

秘密管理

部署管理

部署管理

状态集管理。

转发端口

访问所有信息的工具

日志

文件副本

节点管理

PVC 管理

服务帐号管理

DaemonSet 管理

CronJob 管理
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-EtQdwsoH-1658798011441)(https://miro.medium.com/max/1400/1*AvyQc3P9DN6phZ0mC9iknA.png)]
作业管理

您可以从下面复制和粘贴所有别名。
# This command is used a LOT both below and in daily life
alias k=kubectl
# Execute a kubectl command against all namespaces
alias kca='_kca(){ kubectl "[email protected]" --all-namespaces; unset -f _kca; }; _kca'
# Apply a YML file
alias kaf='kubectl apply -f'
# Drop into an interactive terminal on a container
alias keti='kubectl exec -t -i'
# Manage configuration quickly to switch contexts between local, dev ad staging.
alias kcuc='kubectl config use-context'
alias kcsc='kubectl config set-context'
alias kcdc='kubectl config delete-context'
alias kccc='kubectl config current-context'
# List all contexts
alias kcgc='kubectl config get-contexts'
# General aliases
alias kdel='kubectl delete'
alias kdelf='kubectl delete -f'
# Pod management.
alias kgp='kubectl get pods'
alias kgpa='kubectl get pods --all-namespaces'
alias kgpw='kgp --watch'
alias kgpwide='kgp -o wide'
alias kep='kubectl edit pods'
alias kdp='kubectl describe pods'
alias kdelp='kubectl delete pods'
alias kgpall='kubectl get pods --all-namespaces -o wide'
# get pod by label: kgpl "app=myapp" -n myns
alias kgpl='kgp -l'
# get pod by namespace: kgpn kube-system"
alias kgpn='kgp -n'
# Service management.
alias kgs='kubectl get svc'
alias kgsa='kubectl get svc --all-namespaces'
alias kgsw='kgs --watch'
alias kgswide='kgs -o wide'
alias kes='kubectl edit svc'
alias kds='kubectl describe svc'
alias kdels='kubectl delete svc'
# Ingress management
alias kgi='kubectl get ingress'
alias kgia='kubectl get ingress --all-namespaces'
alias kei='kubectl edit ingress'
alias kdi='kubectl describe ingress'
alias kdeli='kubectl delete ingress'
# Namespace management
alias kgns='kubectl get namespaces'
alias kens='kubectl edit namespace'
alias kdns='kubectl describe namespace'
alias kdelns='kubectl delete namespace'
alias kcn='kubectl config set-context --current --namespace'
# ConfigMap management
alias kgcm='kubectl get configmaps'
alias kgcma='kubectl get configmaps --all-namespaces'
alias kecm='kubectl edit configmap'
alias kdcm='kubectl describe configmap'
alias kdelcm='kubectl delete configmap'
# Secret management
alias kgsec='kubectl get secret'
alias kgseca='kubectl get secret --all-namespaces'
alias kdsec='kubectl describe secret'
alias kdelsec='kubectl delete secret'
# Deployment management.
alias kgd='kubectl get deployment'
alias kgda='kubectl get deployment --all-namespaces'
alias kgdw='kgd --watch'
alias kgdwide='kgd -o wide'
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'
# Rollout management.
alias kgrs='kubectl get replicaset'
alias kdrs='kubectl describe replicaset'
alias kers='kubectl edit replicaset'
alias krh='kubectl rollout history'
alias kru='kubectl rollout undo'
# Statefulset management.
alias kgss='kubectl get statefulset'
alias kgssa='kubectl get statefulset --all-namespaces'
alias kgssw='kgss --watch'
alias kgsswide='kgss -o wide'
alias kess='kubectl edit statefulset'
alias kdss='kubectl describe statefulset'
alias kdelss='kubectl delete statefulset'
alias ksss='kubectl scale statefulset'
alias krsss='kubectl rollout status statefulset'
# Port forwarding
alias kpf="kubectl port-forward"
# Tools for accessing all information
alias kga='kubectl get all'
alias kgaa='kubectl get all --all-namespaces'
# Logs
alias kl='kubectl logs'
alias kl1h='kubectl logs --since 1h'
alias kl1m='kubectl logs --since 1m'
alias kl1s='kubectl logs --since 1s'
alias klf='kubectl logs -f'
alias klf1h='kubectl logs --since 1h -f'
alias klf1m='kubectl logs --since 1m -f'
alias klf1s='kubectl logs --since 1s -f'
# File copy
alias kcp='kubectl cp'
# Node Management
alias kgno='kubectl get nodes'
alias keno='kubectl edit node'
alias kdno='kubectl describe node'
alias kdelno='kubectl delete node'
# PVC management.
alias kgpvc='kubectl get pvc'
alias kgpvca='kubectl get pvc --all-namespaces'
alias kgpvcw='kgpvc --watch'
alias kepvc='kubectl edit pvc'
alias kdpvc='kubectl describe pvc'
alias kdelpvc='kubectl delete pvc'
# Service account management.
alias kdsa="kubectl describe sa"
alias kdelsa="kubectl delete sa"
# DaemonSet management.
alias kgds='kubectl get daemonset'
alias kgdsw='kgds --watch'
alias keds='kubectl edit daemonset'
alias kdds='kubectl describe daemonset'
alias kdelds='kubectl delete daemonset'
# CronJob management.
alias kgcj='kubectl get cronjob'
alias kecj='kubectl edit cronjob'
alias kdcj='kubectl describe cronjob'
alias kdelcj='kubectl delete cronjob'
# Job management.
alias kgj='kubectl get job'
alias kej='kubectl edit job'
alias kdj='kubectl describe job'
alias kdelj='kubectl delete job'
交流
请关注微信公众号【进击云原生】,扫码关注,了解更多咨询,更有免费资源供您学习
边栏推荐
- Matlab uses m file to produce fuzzy controller
- Implementation of queue (sequential storage, chain storage)
- Unity3d 2021 software installation package download and installation tutorial
- NIO this.selector.select()
- VS Code中#include报错(新建的头文件)
- [interprocess communication IPC] - semaphore learning
- Background coupon management
- Forced login, seven cattle cloud upload pictures
- JWT authentication and login function implementation, exit login
- User management - restrictions
猜你喜欢

Aruba学习笔记10-安全认证-Portal认证(web页面配置)

View 的滑动冲突

4274. 后缀表达式

NIO总结文——一篇读懂NIO整个流程

4276. Good at C

General Administration of Customs: the import of such products is suspended

Include error in vs Code (new header file)

Realization of background channel group management function

无法获取下列许可SOLIDWORKS Standard,无法找到使用许可文件。(-1,359,2)。

Pyqt5 rapid development and practice 4.1 qmainwindow
随机推荐
Minio 安装与使用
How to upload qiniu cloud
Do a reptile project by yourself
Background coupon management
Primary function t1744963 character writing
Aruba学习笔记10-安全认证-Portal认证(web页面配置)
Minio installation and use
Digital intelligence innovation
微信安装包从0.5M暴涨到260M,为什么我们的程序越来越大?
Flask request data acquisition and response
Initial summary of flask framework creation project
Tensorflow模型训练和评估的内置方法
[I2C reading mpu6050 of Renesas ra6m4 development board]
Can "Gulangyu yuancosmos" become an "upgraded sample" of China's cultural tourism industry
B tree
How to merge multiple columns in an excel table into one column
Cookie addition, deletion, modification and exception
2034: [Blue Bridge Cup 2022 preliminary] pruning shrubs
[interprocess communication IPC] - semaphore learning
“寻源到结算“与“采购到付款“两者有什么不同或相似之处?