Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send complex command #10

Open
evlahos opened this issue Jan 17, 2024 · 5 comments
Open

Send complex command #10

evlahos opened this issue Jan 17, 2024 · 5 comments

Comments

@evlahos
Copy link

evlahos commented Jan 17, 2024

Hi, very nice work, but I have an issue sending command e.g. ls -l:

"...... node ls -l
Error: must specify one of -f and -k

error: unknown command "ls -"
See 'kubectl create -h' for help and examples"

Any idea?
BR
Vaggelis

@luksa
Copy link
Owner

luksa commented Jan 18, 2024

You probably need to add a -- in front of the command, just like with kubectl exec and others. Not sure which plugin you're invoking, but the command should be:

kubectl someplugin -- some-command --with-options

@evlahos
Copy link
Author

evlahos commented Jan 18, 2024

Hi Luksa
I'm trying the ssh plugin and I want to send "ls -l"
When I send only "ls": e.g. ...ssh node nodeName ls, it works as expected.
but for "ls -l" I have the above error: e.g. ...ssh node nodeName ls -l
I have also tried:
1.
.....ssh node worker-pool1-99xlmfat-n200-vpod1-dsc8989-ipv4 --ls
Warning: would violate PodSecurity "restricted:latest": host namespaces (hostNetwork=true, hostPID=true, hostIPC=true), privileged (container "ssh-node" must not set securityContext.privileged=true), allowPrivilegeEscalation != false (container "ssh-node" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "ssh-node" must set securityContext.capabilities.drop=["ALL"]), restricted volume types (volume "host" uses restricted volume type "hostPath"), runAsNonRoot != true (pod or container "ssh-node" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container "ssh-node" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")
Created pod/ssh-node-7cxf8
Waiting for container to start...
error: Internal error occurred: error executing command in container: failed to exec in container: failed to start exec "a712e90eb12b64a3d8f1e6bcbde0a3dfa57347c26230212dc147060b2978c934": OCI runtime exec failed: exec failed: unable to start container process: exec: "--ls": executable file not found in $PATH: unknown
pod "ssh-node-7cxf8" deleted

....ssh node worker-pool1-99xlmfat-n200-vpod1-dsc8989-ipv4 -- ls
Error: must specify one of -f and -k

error: unknown command "ls -f -"
See 'kubectl create -h' for help and examples

BR
Vaggelis

@yalginayyaltirik
Copy link

yalginayyaltirik commented May 28, 2024

Did the bug fixed? I want to execute the following but it does not work

kubectl ssh node gke-cluster-1-default-pool-5a105e18-9wlf && sudo iptables -t nat -I PREROUTING 1 -s 10.68.1.22 -d 10.3.5.227 -j DNAT --to-destination 10.124.1.25 && sudo iptables -t nat -I POSTROUTING 1 -s 10.68.1.22 -d 10.68.1.24 -j MASQUERADE

Desired update is not performed, but if I execute it into the machine it works.

@rootxrishabh
Copy link

@luksa great work on the plugin!

Facing a similar kind of issue here -
rootxrishabh@Rishabhs-MacBook-Air ~ % k ssh node ip-10-1-103-85.us-west-2.compute.internal "cat /etc/containerd/config.toml" Created pod/ssh-node-554xm Waiting for container to start... error: Internal error occurred: error executing command in container: failed to exec in container: failed to start exec "b6086be96f40deb859bf99a4784f5fe896b577a8837114b1f31178ffef637402": OCI runtime exec failed: exec failed: unable to start container process: exec: "cat /etc/containerd/config.toml": stat cat /etc/containerd/config.toml: no such file or directory: unknown pod "ssh-node-554xm" deleted

@msela9
Copy link

msela9 commented Nov 21, 2024

Suggested fix: #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants