Show me the code

Come up and have a look at it here:

Please note that this isn’t a true kubectl plugin, this is just sample code!

java-test plugin gets pod names and other information, you can limit the namespace scope or use a regex pattern to search for pod names.

$ kubectl java-test -h
Usage: Simple kubectl plugin [-hV] [-n=NAMESPACE] [NAMEPATTERN]
Gets Pods names and other stuff
      [NAMEPATTERN]   Regex pattern
  -h, --help          Show this help message and exit.
  -n, --namespace=NAMESPACE
                      The namespace
  -V, --version       Print version information and exit.


Install Java 11+ and jbang and then:

# Note: the .java extension must be omitted in order to make kubectl able to recognize the plugin
# See
curl -Lo kubectl-java_test
sudo install -m755 kubectl-java_test /usr/local/bin
rm kubectl-java_test


kubectl java-test -n <namespace> <pod_name_regex>

But how can I do it?

More on how to do it yourself later!