README.adoc
June 1, 2019 ยท View on GitHub
= kubectl server-version image:https://circleci.com/gh/bmuschko/kubectl-server-version.svg?style=svg["CircleCI", link="https://circleci.com/gh/bmuschko/kubectl-server-version"] image:https://goreportcard.com/badge/github.com/bmuschko/kubectl-server-version["Go Report Card", link="https://goreportcard.com/report/github.com/bmuschko/kubectl-server-version"]
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 https://github.com/kubernetes-sigs/krew[krew].
Building the binary from source
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.
[source,bash]
go build -o kubectl-server_version
Binaries for a wide range of other platforms can be created with the help of https://github.com/goreleaser/goreleaser[GoReleaser].
[source,bash]
$ 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.
== Installation
The binary must be placed on the $PATH named kubectl-server_version. Ensure that the binary has execution permissions.
For more information, see the https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/[official documentation on kubectl plugins].
== Usage
Run the command server-version to render the Kubernetes server version.
[source,bash]
$ kubectl server-version Hello from Kubernetes server with version v1.10.11!
The subcommand version renders the version of the released binary.