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

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

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

应用 YML 文件

放入容器上的交互式终端

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

列出所有上下文

删除或强制删除

豆荚管理。

按标签获取 pod

通过命名空间获取 pod

服务管理。

入口管理

ConfigMap 管理

秘密管理

部署管理

部署管理

状态集管理。

转发端口

访问所有信息的工具

日志

文件副本

节点管理

PVC 管理

服务帐号管理

DaemonSet 管理

CronJob 管理

作业管理

您可以从下面复制和粘贴所有别名。
# 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'
交流
请关注微信公众号【进击云原生】,扫码关注,了解更多咨询,更有免费资源供您学习

边栏推荐
- MongoDB-使用$type查询某个字段的类型是否为xxx
- 你敢信?开发一个管理系统我只用了两天时间
- ESP8266-Arduino编程实例-开发环境搭建(基于Arduino IDE)
- 绝对路径打开文件相比数据库查询哪个更快?
- 。。。。。。
- Data Lake (19): SQL API reads Kafka data and writes it to iceberg table in real time
- Modeling essay series 151 SCLC engineering experiment 4-sclc object
- Pyechart离线部署
- [error reported]exception: found duplicate column (s) in the data schema: `value`;
- Esp8266 Arduino programming example - know esp8266
猜你喜欢

正点原子stm32中hal库iic模拟`#define SDA_IN() {GPIOB->MODER&=~(3<<(9*2));GPIOB->MODER|=0<<9*2;}` //PB9 输入模式

Cmake常用命令总结

测试用例千万不能随便,记录由一个测试用例异常引起的思考
![[development tool] ieda red](/img/2d/eec1f74c33ff21ae4951eae44b9369.png)
[development tool] ieda red

Server memory failure prediction can actually do this!

Data type of SQL Server database

最新心形拼图小程序源码+带流量主

Pytorch——基于mmseg/mmdet训练报错:RuntimeError: Expected to have finished reduction in the prior iteration

28. Implementation of file directory parsing code

贝尔曼期望方程状严谨证明
随机推荐
Back to the top of several options (JS)
Pyechart离线部署
[error reported]exception: found duplicate column (s) in the data schema: `value`;
Subject 3 turns and turns
win10使用nvm安装node、npm、cnpm
Synchronized and reentrantlock
10 个 Reduce 常用“奇技淫巧”
7月27日19:30直播预告:HarmonyOS3及华为全场景新品发布会
[cloud co creation] what good habits do you adhere to in order to write good code?
28. Implementation of file directory parsing code
大咖观点+500强案例,软件团队应该这样提升研发效能!
JS use webuploader to do blocking and breakpoint continuation of large files
李宏毅《机器学习》丨2. Regression(回归)
服务器内存故障预测居然可以这样做!
【云驻共创】解密SparkRTC如何在全球实现超低时延交互
【通信原理】第一章 -- 绪论
LeetCode / Scala - 两数,三数,四数,N数之和
数据库组成索引和约束
打造绿色数据中心,Colt DCS 是认真的!
Application scheme of ankerui residual pressure monitoring system in residential quarter