当前位置:网站首页>Some practical, commonly used and increasingly efficient kubernetes aliases
Some practical, commonly used and increasingly efficient kubernetes aliases
2022-07-27 08:57:00 【Attack cloud primordial】
In this paper , I will share some aliases with you , These nicknames will significantly speed up your relationship with K8s Interaction .
You can directly copy and paste relevant commands at the end of the article .

Here are some useful aliases that I have used ……
This command is widely used below and in daily life .

Execute for all namespaces kubectl command

application YML file

Put the interactive terminal on the container

Quickly manage the configuration locally 、 Develop the context switching between advertising platforms

List all contexts

Delete or force deletion

Pod management .

Get by tag pod

Get through namespace pod

Service management .

Entrance management

ConfigMap management

Secret management

Deployment management

Deployment management

State set management .

Forward port

Tools to access all information

journal

Copies of documents

Node management

PVC management

Service account management

DaemonSet management

CronJob management
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-EtQdwsoH-1658798011441)(https://miro.medium.com/max/1400/1*AvyQc3P9DN6phZ0mC9iknA.png)]
Job management

You can copy and paste all aliases from below .
# 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'
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
边栏推荐
- 海关总署:这类产品暂停进口
- CUDA programming-01: build CUDA Programming Environment
- 软件测试功能测试全套常见面试题【功能测试-零基础】必备4-1
- 3311. 最长算术
- Arm system call exception assembly
- 4279. Cartesian tree
- HUAWEI 机试题:火星文计算 js
- Linear list (sequential storage, chain storage) (linked list of leading nodes, linked list of non leading nodes)
- Explain cache consistency and memory barrier
- Openresty + keepalived to achieve load balancing + IPv6 verification
猜你喜欢
随机推荐
PyTorch自定义CUDA算子教程与运行时间分析
User management - restrictions
PVT的spatial reduction attention(SRA)
Test picture
CUDA programming-04: CUDA memory model
4275. Dijkstra序列
Matlab 利用M文件产生模糊控制器
一些实用、常用、效率越来越高的 Kubernetes 别名
Matlab solves differential algebraic equations (DAE)
如何在B站上快乐的学习?
Flink1.15 source code reading Flink clients client execution process (reading is boring)
4278. 峰会
Built in method of tensorflow model training and evaluation
E. Split into two sets
Is it safe to buy funds every day? Online and other answers
CUDA programming-01: build CUDA Programming Environment
“鼓浪屿元宇宙”,能否成为中国文旅产业的“升级样本”
5G没能拉动行业发展,不仅运营商失望了,手机企业也失望了
4276. 擅长C
Arm system call exception assembly






![[flutter -- geTx] preparation](/img/5f/96075fa73892db069db51fe789715a.png)

