File tree 5 files changed +130
-2
lines changed
staging/src/k8s.io/kubectl
5 files changed +130
-2
lines changed Original file line number Diff line number Diff line change 33
33
* [ Port Forward to Pods] ( pages/container_debugging/port_forward_to_pods.md )
34
34
* [ Proxying Traffic to Services] ( pages/container_debugging/proxying_traffic_to_services.md )
35
35
36
+ ## Extending Kubectl
37
+
38
+ * [ Plugin mechanism] ( pages/extending_kubectl/plugin_mechanism.md )
39
+ * [ Discovering plugins] ( pages/extending_kubectl/discovering_plugins.md )
40
+
36
41
## App Customization
37
42
38
43
* [ Introduction] ( pages/app_customization/introduction.md )
68
73
* [ Introduction] ( pages/imperative_porcelain/introduction.md )
69
74
* [ Creating Resources] ( pages/imperative_porcelain/creating_resources.md )
70
75
* [ Setting Fields] ( pages/imperative_porcelain/setting_fields.md )
71
- * [ Editing Workloads] ( pages/imperative_porcelain/editing_workloads.md )
76
+ * [ Editing Workloads] ( pages/imperative_porcelain/editing_workloads.md )
Original file line number Diff line number Diff line change
1
+ {% panel style="success", title="Providing Feedback" %}
2
+ ** Provide feedback at the [ survey] ( https://www.surveymonkey.com/r/CLQBQHR ) **
3
+ {% endpanel %}
4
+
5
+ {% panel style="info", title="TL;DR" %}
6
+ - [ krew.dev] ( https://github.com/kubernetes-sigs/krew/#installation ) is a kubernetes sub-project to discover and manage plugins
7
+ {% endpanel %}
8
+
9
+ # Krew
10
+
11
+ By design, ` kubectl ` does not install plugins. This task is left to the kubernetes sub-project
12
+ [ krew.dev] ( https://github.com/kubernetes-sigs/krew/#installation ) which needs to be installed separately.
13
+ Krew helps to
14
+
15
+ - discover plugins
16
+ - get updates for installed plugins
17
+ - remove plugins
18
+
19
+ ## Installing krew
20
+
21
+ Krew should be used as a kubectl plugin. To set yourself up to using krew, you need to do two things:
22
+
23
+ 1 . Install git
24
+ 1 . Install krew as described on the project page [ krew.dev] ( https://github.com/kubernetes-sigs/krew/#installation ) .
25
+ 1 . Add the krew bin folder to your ` PATH ` environment variable. For example, in bash ` export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" ` .
26
+
27
+ ## Krew capabilities
28
+
29
+ {% method %}
30
+ Discover plugins
31
+ {% sample lang="yaml" %}
32
+ ``` bash
33
+ kubectl krew search
34
+ ```
35
+ {% endmethod %}
36
+
37
+ {% method %}
38
+ Install a plugin
39
+ {% sample lang="yaml" %}
40
+ ``` bash
41
+ kubectl krew install access-matrix
42
+ ```
43
+ {% endmethod %}
44
+
45
+ {% method %}
46
+ Upgrade all installed plugins
47
+ {% sample lang="yaml" %}
48
+ ``` bash
49
+ kubectl krew upgrade
50
+ ```
51
+ {% endmethod %}
52
+
53
+ {% method %}
54
+ Show details about a plugin
55
+ {% sample lang="yaml" %}
56
+ ``` bash
57
+ kubectl krew info access-matrix
58
+ ```
59
+ {% endmethod %}
60
+
61
+ {% method %}
62
+ Uninstall a plugin
63
+ {% sample lang="yaml" %}
64
+ ``` bash
65
+ kubectl krew uninstall access-matrix
66
+ ```
67
+ {% endmethod %}
Original file line number Diff line number Diff line change
1
+ {% panel style="success", title="Providing Feedback" %}
2
+ ** Provide feedback at the [ survey] ( https://www.surveymonkey.com/r/CLQBQHR ) **
3
+ {% endpanel %}
4
+
5
+ {% panel style="info", title="TL;DR" %}
6
+ - Drop executables named ` kubectl-plugin_name ` on your ` PATH ` and invoke with ` kubectl plugin-name `
7
+ - ` kubectl plugin list ` shows available plugins
8
+ {% endpanel %}
9
+
10
+ # Kubectl plugins
11
+
12
+ Kubectl plugins are a lightweight mechanism to extend ` kubectl ` with custom functionality to suit your needs.
13
+
14
+ ## Plugin mechanism
15
+
16
+ As of version 1.12, kubectl has a simple plugin mechanism to expose binaries on your ` PATH ` as kubectl subcommands.
17
+ When invoking an unknown subcommand ` kubectl my-plugin ` , kubectl starts searching for an executable named ` kubectl-my_plugin ` on your ` PATH ` .
18
+ Note how the dash is mapped to an underscore. This is to enable plugins that are invoked by multiple words, for example
19
+ ` kubectl my plugin ` would trigger a search for the commands ` kubectl-my-plugin ` or ` kubectl-my ` . The more specific match
20
+ always wins over the other, so if both ` kubectl-my ` and ` kubectl-my-plugin ` exist, the latter will be called.
21
+ When a matching executable is found, kubectl calls it, forwarding all extra arguments.
22
+
23
+ The reference on [ kubernetes.io] ( https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/ ) knows more.
24
+
25
+ {% panel style="info", title="Windows compatibility" %}
26
+ On windows, the minimum required version to use the plugin mechanism is 1.14.
27
+ {% endpanel %}
28
+
29
+ {% method %}
30
+ Listing installed plugins
31
+ {% sample lang="yaml" %}
32
+ ``` bash
33
+ kubectl plugin list
34
+ ```
35
+ {% endmethod %}
Original file line number Diff line number Diff line change @@ -205,3 +205,21 @@ root@nginx-deployment-5c689d88bb-s7xcv:/#
205
205
```
206
206
207
207
{% endmethod %}
208
+
209
+ ## Extending kubectl
210
+
211
+ There is a plugin mechanism to adapt ` kubectl ` to your particular needs.
212
+
213
+ {% method %}
214
+
215
+ Show which plugins are currently available
216
+
217
+ {% sample lang="yaml" %}
218
+
219
+ ``` bash
220
+ kubectl plugin list
221
+ ```
222
+
223
+ {% endmethod %}
224
+
225
+ The easiest way to discover and install plugins is via the kubernetes sub-project [ krew.dev] ( https://github.com/kubernetes-sigs/krew/#installation ) .
Original file line number Diff line number Diff line change 38
38
Provides utilities for interacting with plugins.
39
39
40
40
Plugins provide extended functionality that is not part of the major command-line distribution.
41
- Please refer to the documentation and examples for more information about how write your own plugins.` )
41
+ Please refer to the documentation and examples for more information about how write your own plugins.
42
+
43
+ The easiest way to discover and install plugins is via the kubernetes sub-project krew.
44
+ To install krew, visit [krew.dev](https://github.com/kubernetes-sigs/krew/#installation)` )
42
45
43
46
pluginListLong = templates .LongDesc (`
44
47
List all available plugin files on a user's PATH.
You can’t perform that action at this time.
0 commit comments