2.5.2. Installing and using CLI plugins
After you write a custom plugin for the OpenShift Container Platform CLI, you must install the plugin before use.
Prerequisites
-
You must have the
ocCLI tool installed. -
You must have a CLI plugin file that begins with
oc-orkubectl-.
Procedure
If necessary, update the plugin file to be executable.
$ chmod +x <plugin_file>Place the file anywhere in your
PATH, such as/usr/local/bin/.$ sudo mv <plugin_file> /usr/local/bin/.Run
oc plugin listto make sure that the plugin is listed.$ oc plugin listExample output
The following compatible plugins are available: /usr/local/bin/<plugin_file>If your plugin is not listed here, verify that the file begins with
oc-orkubectl-, is executable, and is on yourPATH.Invoke the new command or option introduced by the plugin.
For example, if you built and installed the
kubectl-nsplugin from the Sample plugin repository, you can use the following command to view the current namespace.$ oc nsNote that the command to invoke the plugin depends on the plugin file name. For example, a plugin with the file name of
oc-foo-baris invoked by theoc foo barcommand.