You can also discover and install kubectl plugins available in the open source using Krew. Krew works across all major platforms, like macOS, Linux and Windows.
On the surface, installing a kubectl plugin seems simple enough – all you need to do is to place an executable in the user’s PATH prefixed with kubectl- – that you may be considering some other alternatives to Krew, such as:
Having the user manually download the plugin executable and move it to some directory in the PATH
Distributing the plugin executable using an OS package manager, like Homebrew (macOS), apt/yum (Linux), or Chocolatey (Windows)
Distributing the plugin executable using a language package manager (e.g. npm or go get)
While these approaches are not necessarily unworkable, potential drawbacks to consider include:
How to get updates to users (in the case of manual installation)
How to package a plugin for multiple platforms (macOS, Linux, and Windows)
How to ensure your users have the appropriate language package manager (go, npm)
How to handle a change to the implementation language (e.g. a move from npm to another package manager)
Krew solves these problems cleanly for all kubectl plugins, since it’s designed specifically to address these shortcomings. With Krew, after you write a plugin manifest once your plugin can be installed on all platforms without having to deal with their package managers.
Once this is done, users would be able to install subctl via krew. Few of krew command examples are:
kubectl krew install subctlkubectl krew upgrade subctl
None of the existing subctl command's behaviour will change except that they would need to be prefixed by kubectl.
$ kubectl subctl --help
An installer for Submariner
Usage:
subctl [command]
Available Commands:
benchmark Benchmark tests
cloud Cloud operations
completion Generate the autocompletion script for the specified shell
deploy-broker Deploys the broker
diagnose Run diagnostic checks on the Submariner deployment and report any issues
export Exports a resource to other clusters
gather Gather troubleshooting information from a cluster
help Help about any command
join Connect a cluster to an existing broker
recover-broker-info Recovers the broker-info.subm file from the installed Broker
show Show information about Submariner
unexport Stop a resource from being exported to other clusters
uninstall Uninstall Submariner and its components
upgrade Upgrades Submariner
verify Run verifications between two clusters
version Get version information on subctl
Flags:
-h, --help help for subctl
Use "subctl [command] --help" for more information about a command.
This would particularly be need to be done if and when we decide to ship subctl as part of OpenShift CLI manager.
A plugin is a standalone executable file, whose name begins with
kubectl-
. To install a plugin, move its executable file to anywhere on yourPATH
.kubectl
provides a commandkubectl plugin list
that searches yourPATH
for valid plugin executables.More information can be found on extending kubectl with plugins page.
You can also discover and install kubectl plugins available in the open source using Krew. Krew works across all major platforms, like macOS, Linux and Windows.
On the surface, installing a kubectl plugin seems simple enough – all you need to do is to place an executable in the user’s PATH prefixed with kubectl- – that you may be considering some other alternatives to Krew, such as:
While these approaches are not necessarily unworkable, potential drawbacks to consider include:
Krew solves these problems cleanly for all kubectl plugins, since it’s designed specifically to address these shortcomings. With Krew, after you write a plugin manifest once your plugin can be installed on all platforms without having to deal with their package managers.
Action items:
Once this is done, users would be able to install subctl via krew. Few of krew command examples are:
kubectl krew install subctl
kubectl krew upgrade subctl
None of the existing
subctl
command's behaviour will change except that they would need to be prefixed bykubectl
.This would particularly be need to be done if and when we decide to ship
subctl
as part ofOpenShift CLI manager
.