Diff
1diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md
2new file mode 100644
3index 0000000000000000000000000000000000000000..a93a9339e63b8f2c21e81676d549f37bd6223c78
4--- /dev/null
5+++ b/plugins/kubectl/README.md
6@@ -0,0 +1,88 @@
7+# Kubectl plugin
8+
9+This plugin adds completion for the [Kubernetes cluster manager](https://kubernetes.io/docs/reference/kubectl/kubectl/),
10+as well as some aliases for common kubectl commands.
11+
12+To use it, add `kubectl` to the plugins array in your zshrc file:
13+
14+```zsh
15+plugins=(... kubectl)
16+```
17+
18+## Aliases
19+
20+| Alias | Command | Description |
21+|:--------|:------------------------------------|:-------------------------------------------------------------------------------------------------|
22+| k | `kubectl` | The kubectl command |
23+| kaf | `kubectl apply -f` | Apply a YML file |
24+| keti | `kubectl exec -ti` | Drop into an interactive terminal on a container |
25+| | | **Manage configuration quickly to switch contexts between local, dev and staging** |
26+| kcuc | `kubectl config use-context` | Set the current-context in a kubeconfig file |
27+| kcsc | `kubectl config set-context` | Set a context entry in kubeconfig |
28+| kcdc | `kubectl config delete-context` | Delete the specified context from the kubeconfig |
29+| kccc | `kubectl config current-context` | Display the current-context |
30+| | | **General aliases** |
31+| kdel | `kubectl delete` | Delete resources by filenames, stdin, resources and names, or by resources and label selector |
32+| kdelf | `kubectl delete -f` | Delete a pod using the type and name specified in -f argument |
33+| | | **Pod management** |
34+| kgp | `kubectl get pods` | List all pods in ps output format |
35+| kgpw | `kgp --watch` | After listing/getting the requested object, watch for changes |
36+| kgpwide | `kgp -o wide` | Output in plain-text format with any additional information. For pods, the node name is included |
37+| kep | `kubectl edit pods` | Edit pods from the default editor |
38+| kdp | `kubectl describe pods` | Describe all pods |
39+| kdelp | `kubectl delete pods` | Delete all pods matching passed arguments |
40+| kgpl | `kgp -l` | Get pod by label. Example: `kgpl "app=myapp" -n myns` |
41+| | | **Service management** |
42+| kgs | `kubectl get svc` | List all services in ps output format |
43+| kgsw | `kgs --watch` | After listing all services, watch for changes |
44+| kgswide | `kgs -o wide` | After listing all services, output in plain-text format with any additional information |
45+| kes | `kubectl edit svc` | Edit services(svc) from the default editor |
46+| kds | `kubectl describe svc` | Describe all services in detail |
47+| kdels | `kubectl delete svc` | Delete all services matching passed argument |
48+| | | **Ingress management** |
49+| kgi | `kubectl get ingress` | List ingress resources in ps output format |
50+| kei | `kubectl edit ingress` | Edit ingress resource from the default editor |
51+| kdi | `kubectl describe ingress` | Describe ingress resource in detail |
52+| kdeli | `kubectl delete ingress` | Delete ingress resources matching passed argument |
53+| | | **Namespace management** |
54+| kgns | `kubectl get namespaces` | List the current namespaces in a cluster |
55+| kens | `kubectl edit namespace` | Edit namespace resource from the default editor |
56+| kdns | `kubectl describe namespace` | Describe namespace resource in detail |
57+| kdelns | `kubectl delete namespace` | Delete the namespace. WARNING! This deletes everything in the namespace |
58+| | | **ConfigMap management** |
59+| kgcm | `kubectl get configmaps` | List the configmaps in ps output format |
60+| kecm | `kubectl edit configmap` | Edit configmap resource from the default editor |
61+| kdcm | `kubectl describe configmap` | Describe configmap resource in detail |
62+| kdelcm | `kubectl delete configmap` | Delete the configmap |
63+| | | **Secret management** |
64+| kgsec | `kubectl get secret` | Get secret for decoding |
65+| kdsec | `kubectl describe secret` | Describe secret resource in detail |
66+| kdelsec | `kubectl delete secret` | Delete the secret |
67+| | | **Deployment management** |
68+| kgd | `kubectl get deployment` | Get the deployment |
69+| kgdw | `kgd --watch` | After getting the deployment, watch for changes |
70+| kgdwide | `kgd -o wide` | After getting the deployment, output in plain-text format with any additional information |
71+| ked | `kubectl edit deployment` | Edit deployment resource from the default editor |
72+| kdd | `kubectl describe deployment` | Describe deployment resource in detail |
73+| kdeld | `kubectl delete deployment` | Delete the deployment |
74+| ksd | `kubectl scale deployment` | Scale a deployment |
75+| krsd | `kubectl rollout status deployment` | Check the rollout status of a deployment |
76+| | | **Rollout management** |
77+| kgrs | `kubectl get rs` | To see the ReplicaSet `rs` created by the deployment |
78+| krh | `kubectl rollout history` | Check the revisions of this deployment |
79+| kru | `kubectl rollout undo` | Rollback to the previous revision |
80+| | | **Port forwarding** |
81+| kpf | `kubectl port-forward` | Forward one or more local ports to a pod |
82+| | | **Tools for accessing all information** |
83+| kga | `kubectl get all` | List all resources in ps format |
84+| kgaa | `kubectl get all --all-namespaces` | List the requested object(s) across all namespaces |
85+| | | **Logs** |
86+| kl | `kubectl logs` | Print the logs for a container or resource |
87+| klf | `kubectl logs -f` | Stream the logs for a container or resource (follow) |
88+| | | **File copy** |
89+| kcp | `kubectl cp` | Copy files and directories to and from containers |
90+| | | **Node management** |
91+| kgno | `kubectl get nodes` | List the nodes in ps output format |
92+| keno | `kubectl edit node` | Edit nodes resource from the default editor |
93+| kdno | `kubectl describe node` | Describe node resource in detail |
94+| kdelno | `kubectl delete node` | Delete the node |
95diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh
96index 59601f413faafcb82ea313e177284b912aaff093..4cfe3f45b1e8316d4f26fb9689d7e9f84c02f23d 100644
97--- a/plugins/kubectl/kubectl.plugin.zsh
98+++ b/plugins/kubectl/kubectl.plugin.zsh
99@@ -38,7 +38,7 @@ alias kdp='kubectl describe pods'
100 alias kdelp='kubectl delete pods'
101
102 # get pod by label: kgpl "app=myapp" -n myns
103-alias kgpl='function _kgpl(){ label=$1; shift; kgp -l $label $*; };_kgpl'
104+alias kgpl='kgp -l'
105
106 # Service management.
107 alias kgs='kubectl get svc'
108@@ -104,4 +104,4 @@ alias kcp='kubectl cp'
109 alias kgno='kubectl get nodes'
110 alias keno='kubectl edit node'
111 alias kdno='kubectl describe node'
112-alias kdelno='kubectl delete node'
113+alias kdelno='kubectl delete node'