| title | Using Custom Plugin Indexes |
|---|---|
| slug | custom-indexes |
| weight | 800 |
Plugin indexes contain plugin manifests, which are documents that describe the
installation procedure for a plugin. For discovery purposes, Krew comes with a
default plugin index, plugins hosted in the krew-index repository.
However, some plugin authors may choose to host their own indexes that contain their curation of kubectl plugins. These are called "custom plugin indexes".
If you need to serve your plugin archive behind authentication, see [this page]({{< ref "serving-plugins-privately.md" >}}).
A custom plugin index can be added with the kubectl krew index add command:
{{<prompt>}}kubectl krew index add foo https://github.com/foo/custom-index.gitThe URI you use can be any git remote
(e.g., git@github.com:foo/custom-index.git).
You can remove a custom plugin index by passing the name it was added with to
the index remove command:
{{<prompt>}}kubectl krew index remove fooTo see what indexes you have added run the index list command:
{{<prompt>}}kubectl krew index list
{{<output>}}INDEX URL
default https://github.com/kubernetes-sigs/krew-index.git
foo https://github.com/foo/custom-index.git{{</output>}}Commands for managing plugins (e.g. install, upgrade) work with custom
indexes as well.
By default, Krew prefixes plugins with a default/ prefix. So, to install
a plugin from a custom index, you need to specify it in the format
INDEX_NAME/PLUGIN_NAME.
For example, to install a plugin named bar from custom index foo:
{{<prompt>}}kubectl krew install foo/barSimilarly:
-
To list all plugins (including the ones from custom indexes), run:
{{<prompt>}}kubectl krew search -
To remove a plugin, you don't need to specify its index:
{{<prompt>}}kubectl krew uninstall PLUGIN_NAME -
To get information about a plugin from a custom index:
{{<prompt>}}kubectl krew info INDEX_NAME/PLUGIN_NAME
Note: If two indexes each include a plugin with the same name, only one can be installed at any time.
When you don't include an explicit INDEX_NAME prefix in your Krew command, the
command will refer to a plugin from the default index. The INDEX_NAME prefix is
used to differentiate plugins with the same name across different indexes.
Krew ships with krew-index as the default index, but this can be
removed using the kubectl krew index remove default command. Once it is
removed, you can add another index with the name default and plugins from it
will not require the INDEX_NAME prefix in commands.