Open holmesb opened 6 years ago
@holmesb , I get the same problem , Did you solve this ?
https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/
Discovering plugins
kubectl provides a command kubectl plugin list that searches your PATH for valid plugin executables. Executing this command causes a traversal of all files in your PATH. Any files that are executable, and begin with kubectl- will show up in the order in which they are present in your PATH in this command’s output. A warning will be included for any files beginning with kubectl- that are not executable. A warning will also be included for any valid plugin files that overlap each other’s name.
renaming necessary to avoid this warning:
- warning: kubectl-exec-user overwrites existing command: "kubectl exec"
$ ln -s `pwd`/exec-user/exec-user.sh ~/.local/bin/kubectl-execuser
however, this is not sufficient, whole option parsing must be implemented by the standalone script
Note: Unlike previous versions of kubectl, the plugin mechanism will not create any custom, plugin-specific values or environment variables to a plugin process. This means that environment variables such as KUBECTL_PLUGINS_CURRENT_NAMESPACE are no longer provided to a plugin. Plugins must parse all of the arguments passed to them by a user, and handle flag validation as part of their own implementation. For plugins written in Go, a set of utilities has been provided under k8s.io/cli-runtime to assist with this.
We already have an exec-as
plugin that pretty much does the same thing in Krew plugin manager: https://github.com/kubernetes-sigs/krew/
tested exec-as
, works fine, so this repo can be considered obsolete for kubectl >= 1.12
Both exec-user and exec-as fail for me.
I'm on kubectl client version v1.12.0 and can't get this to work. I added the following to my path: ~/.kube/plugins ~/.kube/plugins/exec-user
But get:
If I rename ~/.kube/plugins/exec-user/exec-user.sh to ~/.kube/plugins/exec-user/kubectl-exec-user.sh I get:
But when I try to use this plugin, I get: user@host~/$ kubectl plugin exec-user pod /bin/bash error: unknown command "exec-user test /bin/bash" See 'kubectl plugin -h' for help and examples.
Any ideas? Does this need to be brought in line with the latest documentation?