kubectl-plugins: get errors while the ssh command invoking

Hello, I followed the README guide to run the tool (on the master branch) and got several errors. Did I use it in the wrong way? please help, thanks a lot.

I am using k8s 1.13.5 as below:

kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.4", GitCommit:"c27b913fddd1a6c480c229191a087698aa92f0b1", GitTreeState:"clean", BuildDate:"2019-02-28T13:37:52Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.5", GitCommit:"2166946f41b36dea2c4626f90a77706f426cdea2", GitTreeState:"clean", BuildDate:"2019-03-25T15:19:22Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}

when I install the plugins, it shows:

root@robota:~/kubectl-plugins# ./install-plugins.sh

Done.
Please open a new terminal or run: source ~/.bash_profile

The following kubectl-compatible plugins are available:

kubectl image
kubectl ip
kubectl prompt
kubectl ssh
kubectl switch
kubectl uptime

when I run the commands, it shows these:

kubectl ssh -n gitlab-managed-apps -u root -p runner-gitlab-runner-789c484674-bfdtd

Connecting...
Pod: -n
User: root
Container:
Command:/bin/sh

Error: unknown command "value>" for "kubectl"
Run 'kubectl --help' for usage.
unknown command "value>" for "kubectl"
Error: unknown command "value>" for "kubectl"
Run 'kubectl --help' for usage.
unknown command "value>" for "kubectl"
Error: unknown command "value>" for "kubectl"
Run 'kubectl --help' for usage.
unknown command "value>" for "kubectl"
whoami

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 15 (9 by maintainers)

Most upvoted comments

Awesome, and thanks for providing the log output!

@TAnas0 @machine424 @zhang-shengping i pushed a commit to master that I hope will fix the issue. Could you pull down the latest, reinstall and try again? If you see an error again, please provide logs. Much appreciated.

Hey there,

Facing the same issue in here and this si the output of the command bash -x kubectl-ssh -u root -p <PODNAME>:

+ trap 'kubectl delete pod $container >/dev/null 2>&1 &' 0 1 2 3 15
+ '[' 4 -eq 0 ']'
+ getopts :u:c:p:h arg
+ case $arg in
+ USERNAME=root
+ getopts :u:c:p:h arg
+ case $arg in
+ POD=lighthouse-bot-79ff758855-jgqg5
+ getopts :u:c:p:h arg
++ echo -u root -p lighthouse-bot-79ff758855-jgqg5
++ grep '\-\-'
++ sed 's|\(.*\) -- \(.*\)|\2|g'
+ COMMAND=
+ COMMAND=/bin/sh
+ '[' -z lighthouse-bot-79ff758855-jgqg5 ']'
+ USERNAME=root
+ '[' -z lighthouse-bot-79ff758855-jgqg5 ']'
+ echo -e '\nConnecting...\nPod: lighthouse-bot-79ff758855-jgqg5\nUser: root\nContainer:\nCommand:/bin/sh\n'

Connecting...
Pod: lighthouse-bot-79ff758855-jgqg5
User: root
Container:
Command:/bin/sh

++ which kubectl
+ KUBECTL=/usr/bin/kubectl
+++ kubectl config current-context
++ kubectl config view '--template={{ range .contexts }}{{ if eq .name "gke_frontscan_us-central1-a_lighthouse-cluster" }}{{ .context.namespace }}{{ end }}{{ end }}'
+ NAMESPACE='<no value>'
+++ whoami
++ exec kubectl get po anas-1
+ test ''
++ whoami
+ container=anas-1
++ /usr/bin/kubectl --namespace '<no' 'value>' get pod lighthouse-bot-79ff758855-jgqg5 -o 'go-template={{.spec.nodeName}}'
Error: unknown command "value>" for "kubectl"
Run 'kubectl --help' for usage.
unknown command "value>" for "kubectl"
+ NODENAME=
+ NODESELECTOR='"nodeSelector": {"kubernetes.io/hostname": ""},'
++ /usr/bin/kubectl --namespace '<no' 'value>' get pod lighthouse-bot-79ff758855-jgqg5 '-ojsonpath={.spec.tolerations[].value}'
Error: unknown command "value>" for "kubectl"
Run 'kubectl --help' for usage.
unknown command "value>" for "kubectl"
+ TOLERATION_VALUE=
+ [[ -n '' ]]
+ TOLERATIONS=
+ [[ -n '' ]]
++ /usr/bin/kubectl --namespace '<no' 'value>' get pod lighthouse-bot-79ff758855-jgqg5 -o 'go-template={{ (index .status.containerStatuses 0).containerID }}'
Error: unknown command "value>" for "kubectl"
Run 'kubectl --help' for usage.
unknown command "value>" for "kubectl"
+ DOCKER_CONTAINERID=
+ CONTAINERID=
+ read -r -d '' OVERRIDES
+ eval kubectl run -it --restart=Never --image=docker '--overrides='\''{
    "apiVersion": "v1",
    "spec": {
        "containers": [
            {
                "image": "docker",
                "name": "'\''anas-1'\''",
                "stdin": true,
                "stdinOnce": true,
                "tty": true,
                "restartPolicy": "Never",
                "args": [
                  "exec",
                  "-it",
                  "-u",
                  "root",
                  "",
                  "/bin/sh"
                ],
                "volumeMounts": [
                    {
                        "mountPath": "/var/run/docker.sock",
                        "name": "docker"
                    }
                ]
            }
        ],

        "nodeSelector": {"kubernetes.io/hostname": ""},

        

        "volumes": [
            {
                "name": "docker",
                "hostPath": {
                    "path": "/var/run/docker.sock",
                    "type": "File"
                }
            }
        ]
    }
}'\''' anas-1
++ kubectl run -it --restart=Never --image=docker '--overrides={
    "apiVersion": "v1",
    "spec": {
        "containers": [
            {
                "image": "docker",
                "name": "anas-1",
                "stdin": true,
                "stdinOnce": true,
                "tty": true,
                "restartPolicy": "Never",
                "args": [
                  "exec",
                  "-it",
                  "-u",
                  "root",
                  "",
                  "/bin/sh"
                ],
                "volumeMounts": [
                    {
                        "mountPath": "/var/run/docker.sock",
                        "name": "docker"
                    }
                ]
            }
        ],

        "nodeSelector": {"kubernetes.io/hostname": ""},

        

        "volumes": [
            {
                "name": "docker",
                "hostPath": {
                    "path": "/var/run/docker.sock",
                    "type": "File"
                }
            }
        ]
    }
}' anas-1

Hope this helps