kubectl-plugins icon indicating copy to clipboard operation
kubectl-plugins copied to clipboard

exec-as not working with containerd

Open ineffyble opened this issue 4 years ago • 6 comments

I was originally getting the type issue and applied the fix at https://github.com/jordanwilson230/kubectl-plugins/pull/36/files

Now I get a different error:

If you don't see a command prompt, try pressing enter.
Error attaching, falling back to logs: unable to upgrade connection: container effy-1 not found in pod effy-1_default
error during connect: Get "http://docker:2375/v1.24/containers/52b9ff502b9f1d16dc34808ecfe37702c985b0643bb8313d149c2c7121c1a3f6/json": dial tcp: lookup docker on 100.64.0.10:53: no such host
pod default/effy-1 terminated (Error)

My version details:

Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.9", GitCommit:"7a576bc3935a6b555e33346fd73ad77c925e9e4a", GitTreeState:"clean", BuildDate:"2021-07-15T21:01:38Z", GoVersion:"go1.15.14", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.9", GitCommit:"7a576bc3935a6b555e33346fd73ad77c925e9e4a", GitTreeState:"clean", BuildDate:"2021-07-15T20:56:38Z", GoVersion:"go1.15.14", Compiler:"gc", Platform:"linux/amd64"}

ineffyble avatar Aug 23 '21 03:08 ineffyble

I get a different error from kubectl ssh on a containerd-based cluster (Container-Optimized OS from Google, containerd://1.5.11, v1.23.6-gke.2200):

Connecting...
Pod: <redacted>
Namespace: NONE
User: root
Container: <redacted>
Command: /bin/sh

Error: No such container: 1c…c0
pod <redacted>/ssh-pod-2016 terminated (Error)

Seems to be parsing out a container id from the application pod containerd://1c…c0.

jglick avatar Jun 23 '22 17:06 jglick

It's not working with k8s 1.22 on GKE for me too. I just got:

$ kubectl exec-as -u root -n bar -c foo foobar-5f9957469b-ggcc7

Connecting...
Pod: foobar-5f9957469b-ggcc7
Namespace: bar
User: root
Container: foo
Command: /bin/sh

error: timed out waiting for the condition

gdubicki avatar Oct 18 '22 10:10 gdubicki

Yup same, newer versions of K8s do not seem to work with this anymore now that docker does not exist on the node

tripflex avatar Nov 01 '22 16:11 tripflex

https://stackoverflow.com/questions/42793382/exec-commands-on-kubernetes-pods-with-root-access

Seems the plugin should be aware of the container back end since it can now also be containerd and cri-o.

rejoshed avatar Dec 22 '22 00:12 rejoshed