A simple kubectl plugin for displaying the Kubernetes server version. This project is meant to demonstrate the use of the Go-based Kubernetes client API invoked from a kubectl plugin. Therefore, the plugin has not been registered with the kubectl plugin manager krew.
The project requires Go 1.11 or higher as dependencies are defined with the help of Go Modules.
First, activate Go Modules by setting the relevant environment variable.
Next, create the platform-specific binary with the build
command.
$ export GO111MODULES=on
$ go build -o kubectl-server_version
Binaries for a wide range of other platforms can be created with the help of GoReleaser.
$ goreleaser release --skip-validate --snapshot --rm-dist
To release a new version of the binaries to GitHub Releases, create a Git tag and remove the relevant flags in the command above.
The binary must be placed on the $PATH
named kubectl-server_version
. Ensure that the binary has execution permissions.
For more information, see the official documentation on kubectl plugins.