当前位置:网站首页>一些实用、常用、效率越来越高的 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
- An error occurred in the scrapy shell
- Machine learning by Li Hongyi 2. Regression
- Creation and modification of basic tables and data in them by SQL statements of SQL Server
- MySQL deadlock analysis
- ESP8266-Arduino编程实例-GPIO输入和输出
- 28. Implementation of file directory parsing code
- The latest heart-shaped puzzle applet source code + with flow master
- ESP8266-Arduino编程实例-开发环境搭建(基于PlatformIO)
- Back to the top of several options (JS)
猜你喜欢

The latest heart-shaped puzzle applet source code + with flow master

大咖观点+500强案例,软件团队应该这样提升研发效能!

3.2 创建菜单与游戏页面(下)

Leetcode / Scala - sum of two numbers, three numbers, four numbers, and N numbers

Build neural network from simple to deep
![36. [difference between const function and function]](/img/14/0f01fdace2ec17e873522cef4ac735.png)
36. [difference between const function and function]

Three properties of concurrency

4.1 配置Mysql与注册登录模块

社区点赞业务缓存设计优化探索

Substance Painter 2021软件安装包下载及安装教程
随机推荐
Swagger2.9.2 tutorial and swagger3.0.0 tutorial
Database composition trigger
数据库组成索引和约束
MySQL locking mechanism
数据中台建设(二):数据中台简单介绍
Esp8266 Arduino programming example - development environment construction (based on platformio)
Pytorch——基于mmseg/mmdet训练报错:RuntimeError: Expected to have finished reduction in the prior iteration
Summary of common cmake commands
Scrapy IP agent is not responding
Getting started step by step using g2o to solve ICP problems - estimating the transformation relationship between two sets of 3D point sets with matching relationship
了解 useRef 一篇就够了
安科瑞余压监控系统在住宅小区的应用方案
Build neural network from simple to deep
武林头条-建站小能手争霸赛
加载ORB词典
Common library installation
PostgreSQL in Linux and windows installation and introductory basic tutorial
[error reporting] what do you read in the log
Modeling essay series 150 SCLC engineering experiment 3-srule
Back to the top of several options (JS)