From 8260005dc7bba42d82edd8e606c10d9e7a9bb26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20Moreira?= Date: Tue, 14 Jul 2020 11:39:33 -0400 Subject: [PATCH] kubectl: add alias to list pods by namespace (#8604) --- plugins/kubectl/README.md | 3 ++- plugins/kubectl/kubectl.plugin.zsh | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md index c0db59362..ee05a8af1 100644 --- a/plugins/kubectl/README.md +++ b/plugins/kubectl/README.md @@ -33,7 +33,8 @@ plugins=(... kubectl) | kep | `kubectl edit pods` | Edit pods from the default editor | | kdp | `kubectl describe pods` | Describe all pods | | kdelp | `kubectl delete pods` | Delete all pods matching passed arguments | -| kgpl | `kgp -l` | Get pod by label. Example: `kgpl "app=myapp" -n myns` | +| 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** | | kgs | `kubectl get svc` | List all services in ps output format | | kgsw | `kgs --watch` | After listing all services, watch for changes | diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 92688c53c..647d029c1 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -47,6 +47,9 @@ alias kdelp='kubectl delete pods' # 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'