当前位置:网站首页>After summarizing more than 800 kubectl aliases, I'm no longer afraid that I can't remember commands!
After summarizing more than 800 kubectl aliases, I'm no longer afraid that I can't remember commands!
2022-07-05 23:51:00 【Attack cloud primordial】
Sum up 800 Multiple Kubectl Alias , I'm no longer afraid that I can't remember orders !
This repository contains scripts gener_ aliases.py
It can generate hundreds of convenient kubectl shell Alias , You no longer need to spell out every command and --flag
Parameters .
https://github.com/ahmetb/kubectl-aliases/blob/master/generate_aliases.py
Through the command / Flag arrangement created shell Examples of aliases are as follows :
alias ksysgdepwslowidel='kubectl --namespace=kube-system get deployment --watch --show-labels -o=wide -l'
Example
800 An alias , Some are listed below :
alias k='kubectl'
alias kg='kubectl get'
alias kgpo='kubectl get pod'
alias ksysgpo='kubectl --namespace=kube-system get pod'
alias krm='kubectl delete'
alias krmf='kubectl delete -f'
alias krming='kubectl delete ingress'
alias krmingl='kubectl delete ingress -l'
alias krmingall='kubectl delete ingress --all-namespaces'
alias kgsvcoyaml='kubectl get service -o=yaml'
alias kgsvcwn='kubectl get service --watch --namespace'
alias kgsvcslwn='kubectl get service --show-labels --watch --namespace'
alias kgwf='kubectl get --watch -f'
...
Visit the address below , See all aliases :
https://github.com/ahmetb/kubectl-aliases/blob/master/.kubectl_aliases
install
You can download bash/zsh The file of .kubectl_aliases
:
https://raw.githubusercontent.com/ahmetb/kubectl-aliases/master/.kubectl_aliases
perhaps fish The file of .kubectl_aliases.fish
, And save it to $HOME
Directory .
https://raw.githubusercontent.com/ahmetb/kubectl-aliases/master/.kubectl_aliases.fish
Bash/Zsh
Add the following to your .bashrc/.zshrc
In file :
[ -f ~/.kubectl_aliases ] && source ~/.kubectl_aliases
Suggest : If you want to use GNU watch Order, not kubectl [...] --watch, Please run like this :
[ -f ~/.kubectl_aliases ] && source \
<(cat ~/.kubectl_aliases | sed -r 's/(kubectl.*) --watch/watch \1/g')
Print the complete command before running : Add it to your .bashrc
or .zshrc
In file :
function kubectl() { echo "+ kubectl [email protected]">&2; command kubectl [email protected]; }
Fish
Add the following to your ~/.config/fish/config.fish
file :
test -f ~/.kubectl_aliases.fish && source ~/.kubectl_aliases.fish
This actually adds more powerful fish abbreviation :
https://fishshell.com/docs/current/cmds/abbr.html
Not an alias , In this way, press the space to display the complete command before execution .
Suggest : If you want to use GNU watch Order, not kubectl [...] --watch, Please run like this :
test -f ~/.kubectl_aliases.fish && source \
(cat ~/.kubectl_aliases.fish | sed -r 's/(kubectl.*) --watch/watch \1/g' | psub)
Grammar explanation
k
=kubectl
sys
=--namespace kube-system
commands: g
=get
d
=describe
rm
=delete
a
:apply -f
ak
:apply -k
k
:kustomize
ex
:exec -i -t
lo
:logs -f
resources: po
=pod,dep
=deployment
,ing
=ingress
,svc
=service
,cm
=configmap
,sec
=secret
,ns
=namespace
,no
=node
flags: output format: oyaml
,ojson
,owide
all
:--all
or--all-namespaces
depending on the commandsl
:--show-labels
w
=-w/--watch
value flags (should be at the end): n
=-n/--namespace
f
=-f/--filename
l
=-l/--selector
Run script
The script has only one optional parameter , namely : Alias will be generated shell. If you don't specify , The default is bash
. for example :
# Generate aliases for bash/zsh
python generate_aliases.py > .kubectl_aliases
# Generate abbr for fish
python generate_aliases.py fish > .kubectl_aliases.fish
communication
Please follow the WeChat public account 【 Attack the cloud 】, Sweep yards attention , Learn more about consulting , There are more free resources for you to learn
边栏推荐
- yate. conf
- 数据库遇到的问题
- 【二叉搜索树】增删改查功能代码实现
- Make a short video clip number of we media film and television. Where can I download the material?
- Research notes I software engineering and calculation volume II (Chapter 1-7)
- 如何让同步/刷新的图标(el-icon-refresh)旋转起来
- In C#, why can't I modify the member of a value type instance in a foreach loop?
- Switching power supply buck circuit CCM and DCM working mode
- Rasa 3. X learning series -rasa 3.2.1 new release
- GFS分布式文件系統
猜你喜欢
Bao Yan notebook IV software engineering and calculation volume II (Chapter 8-12)
4点告诉你实时聊天与聊天机器人组合的优势
Spire Office 7.5.4 for NET
698. Divided into k equal subsets ●●
STM32__06—单通道ADC
el-cascader的使用以及报错解决
Spire. PDF for NET 8.7.2
[classical control theory] summary of automatic control experiment
【二叉搜索树】增删改查功能代码实现
MySQL delete uniqueness constraint unique
随机推荐
CIS benchmark tool Kube bench
11gR2 Database Services for &quot; Policy&quot; and &quot; Administrator&quot; Managed databases (file I
Rsync remote synchronization
动态规划 之 打家劫舍
C reflection and type
15 MySQL-存储过程与函数
Cloudcompare & PCL point cloud randomly adds noise
多普勒效应(多普勒频移)
Make a short video clip number of we media film and television. Where can I download the material?
QCombox(重写)+QCompleter(自动补全,自动加载qcombox的下拉选项,设置背景颜色)
Golang code checking tool
Zhuan: in the future, such an organization can withstand the risks
18.(arcgis api for js篇)arcgis api for js点采集(SketchViewModel)
CIS基准测试工具kube-bench使用
5. Logistic regression
零犀科技携手集智俱乐部:“因果派”论坛成功举办,“因果革命”带来下一代可信AI
同事悄悄告诉我,飞书通知还能这样玩
GFS Distributed File System
My colleagues quietly told me that flying Book notification can still play like this
上门预约服务类的App功能详解