1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-13 09:20:09 +00:00

feat(kubectl): show labels in aliases kgpsl (get pod) and kgnosl (get node) (#12612)

Co-authored-by: Marc Cornellà <marc@mcornella.com>
This commit is contained in:
Jérémy 2024-09-05 19:57:11 +02:00 committed by GitHub
parent e6380085f3
commit bc42097900
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 122 additions and 122 deletions

View file

@ -12,7 +12,7 @@ plugins=(... kubectl)
## Aliases ## Aliases
| Alias | Command | Description | | Alias | Command | Description |
|:--------|:------------------------------------|:-------------------------------------------------------------------------------------------------| | :------- | :------------------------------------------------- | :----------------------------------------------------------------------------------------------- |
| k | `kubectl` | The kubectl command | | k | `kubectl` | The kubectl command |
| kca | `kubectl --all-namespaces` | The kubectl command targeting all namespaces | | kca | `kubectl --all-namespaces` | The kubectl command targeting all namespaces |
| kaf | `kubectl apply -f` | Apply a YML file | | kaf | `kubectl apply -f` | Apply a YML file |
@ -28,13 +28,14 @@ plugins=(... kubectl)
| kdelf | `kubectl delete -f` | Delete a pod using the type and name specified in -f argument | | kdelf | `kubectl delete -f` | Delete a pod using the type and name specified in -f argument |
| | | **Pod management** | | | | **Pod management** |
| kgp | `kubectl get pods` | List all pods in ps output format | | kgp | `kubectl get pods` | List all pods in ps output format |
| kgpl | `kgp -l` | Get pods by label. Example: `kgpl "app=myapp" -n myns` |
| kgpn | `kgp -n` | Get pods by namespace. Example: `kgpn kube-system` |
| kgpsl | `kubectl get pods --show-labels` | List all pods in ps output format with labels |
| kgpw | `kgp --watch` | After listing/getting the requested object, watch for changes | | kgpw | `kgp --watch` | After listing/getting the requested object, watch for changes |
| kgpwide | `kgp -o wide` | Output in plain-text format with any additional information. For pods, the node name is included | | kgpwide | `kgp -o wide` | Output in plain-text format with any additional information. For pods, the node name is included |
| kep | `kubectl edit pods` | Edit pods from the default editor | | kep | `kubectl edit pods` | Edit pods from the default editor |
| kdp | `kubectl describe pods` | Describe all pods | | kdp | `kubectl describe pods` | Describe all pods |
| kdelp | `kubectl delete pods` | Delete all pods matching passed arguments | | kdelp | `kubectl delete pods` | Delete all pods matching passed arguments |
| kgpl | `kgp -l` | Get pods by label. Example: `kgpl "app=myapp" -n myns` |
| kgpn | `kgp -n` | Get pods by namespace. Example: `kgpn kube-system` |
| | | **Service management** | | | | **Service management** |
| kgs | `kubectl get svc` | List all services in ps output format | | kgs | `kubectl get svc` | List all services in ps output format |
| kgsw | `kgs --watch` | After listing all services, watch for changes | | kgsw | `kgs --watch` | After listing all services, watch for changes |
@ -90,6 +91,7 @@ plugins=(... kubectl)
| kcp | `kubectl cp` | Copy files and directories to and from containers | | kcp | `kubectl cp` | Copy files and directories to and from containers |
| | | **Node management** | | | | **Node management** |
| kgno | `kubectl get nodes` | List the nodes in ps output format | | kgno | `kubectl get nodes` | List the nodes in ps output format |
| kgnosl | `kubectl get nodes --show-labels` | List the nodes in ps output format with labels |
| keno | `kubectl edit node` | Edit nodes resource from the default editor | | keno | `kubectl edit node` | Edit nodes resource from the default editor |
| kdno | `kubectl describe node` | Describe node resource in detail | | kdno | `kubectl describe node` | Describe node resource in detail |
| kdelno | `kubectl delete node` | Delete the node | | kdelno | `kubectl delete node` | Delete the node |

View file

@ -39,6 +39,9 @@ alias kdelf='kubectl delete -f'
# Pod management. # Pod management.
alias kgp='kubectl get pods' alias kgp='kubectl get pods'
alias kgpl='kgp -l'
alias kgpn='kgp -n'
alias kgpsl='kubectl get pods --show-labels'
alias kgpa='kubectl get pods --all-namespaces' alias kgpa='kubectl get pods --all-namespaces'
alias kgpw='kgp --watch' alias kgpw='kgp --watch'
alias kgpwide='kgp -o wide' alias kgpwide='kgp -o wide'
@ -47,12 +50,6 @@ alias kdp='kubectl describe pods'
alias kdelp='kubectl delete pods' alias kdelp='kubectl delete pods'
alias kgpall='kubectl get pods --all-namespaces -o wide' 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. # Service management.
alias kgs='kubectl get svc' alias kgs='kubectl get svc'
alias kgsa='kubectl get svc --all-namespaces' alias kgsa='kubectl get svc --all-namespaces'
@ -144,6 +141,7 @@ alias kcp='kubectl cp'
# Node Management # Node Management
alias kgno='kubectl get nodes' alias kgno='kubectl get nodes'
alias kgnosl='kubectl get nodes --show-labels'
alias keno='kubectl edit node' alias keno='kubectl edit node'
alias kdno='kubectl describe node' alias kdno='kubectl describe node'
alias kdelno='kubectl delete node' alias kdelno='kubectl delete node'