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

Configure 'args' for shellPod #1104

Closed
yogeek opened this issue Apr 27, 2021 · 5 comments
Closed

Configure 'args' for shellPod #1104

yogeek opened this issue Apr 27, 2021 · 5 comments

Comments

@yogeek
Copy link

yogeek commented Apr 27, 2021




Is your feature request related to a problem? Please describe.
shellPod is great but being able to configure image, namespace and limits is frustrating ^^
For example, when I launch a shell on a node, I do not have access to all commands on the node, only the ones in the container (because the filesystem of the node is mounted in a subpath, and not as chroot of the container).

Describe the solution you'd like
Being able to configure args for the shellPod would allow to use commands directly accessible from the node directly (e.g. docker ps) :

shellPod:
        image: alpine
        args:
        - chroot
        - /hostfs
        - /bin/bash
        namespace: blee
        limits:
          cpu: 100m
          memory: 100Mi

Describe alternatives you've considered

The node-admin krew plugin is great for this and having this feature directly in k9s would be awesome because it would avoid having to deal with SSH for admins to connect to the nodes.

@gitfool
Copy link

gitfool commented May 2, 2021

@yogeek @derailed I can't seem to get chroot to work with with k9s v0.24.8:

featureGates:
  nodeShell: true
shellPod:
  image: ubuntu:focal
  command:
    - /usr/sbin/chroot
  args:
    - /host
    - /bin/bash
  namespace: default
  limits:
    cpu: 100m
    memory: 100Mi

However, once inside the running container I can use chroot as expected:

<<K9s-Shell>> Pod: default/k9s-shell-13632 | Container: k9s-shell

root@ip-10-16-69-216:/# ll
total 0
drwxr-xr-x   1 root root   29 May  2 03:51 ./
drwxr-xr-x   1 root root   29 May  2 03:51 ../
-rwxr-xr-x   1 root root    0 May  2 03:51 .dockerenv*
lrwxrwxrwx   1 root root    7 Apr 16 05:11 bin -> usr/bin/
drwxr-xr-x   2 root root    6 Apr 15  2020 boot/
drwxr-xr-x  10 root root 2740 May  2 03:51 dev/
drwxr-xr-x   1 root root   66 May  2 03:51 etc/
drwxr-xr-x   2 root root    6 Apr 15  2020 home/
dr-xr-xr-x  18 root root  257 Apr  6 20:16 host/
lrwxrwxrwx   1 root root    7 Apr 16 05:11 lib -> usr/lib/
lrwxrwxrwx   1 root root    9 Apr 16 05:11 lib32 -> usr/lib32/
lrwxrwxrwx   1 root root    9 Apr 16 05:11 lib64 -> usr/lib64/
lrwxrwxrwx   1 root root   10 Apr 16 05:11 libx32 -> usr/libx32/
drwxr-xr-x   2 root root    6 Apr 16 05:11 media/
drwxr-xr-x   2 root root    6 Apr 16 05:11 mnt/
drwxr-xr-x   2 root root    6 Apr 16 05:11 opt/
dr-xr-xr-x 216 root root    0 Apr  6 20:16 proc/
drwx------   2 root root   37 Apr 16 05:32 root/
drwxr-xr-x   1 root root   21 May  2 03:51 run/
lrwxrwxrwx   1 root root    8 Apr 16 05:11 sbin -> usr/sbin/
drwxr-xr-x   2 root root    6 Apr 16 05:11 srv/
dr-xr-xr-x  13 root root    0 Apr  6 20:16 sys/
drwxrwxrwt   2 root root    6 Apr 16 05:33 tmp/
drwxr-xr-x   1 root root   18 Apr 16 05:11 usr/
drwxr-xr-x   1 root root   17 Apr 16 05:32 var/

root@ip-10-16-69-216:/# docker version
bash: docker: command not found

root@ip-10-16-69-216:/# chroot /host /bin/bash

[root@ip-10-16-69-216 /]# docker version
Client:
 Version:           19.03.13-ce
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        4484c46
 Built:             Mon Oct 12 18:51:20 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          19.03.13-ce
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       4484c46
  Built:            Mon Oct 12 18:51:50 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.1
  GitCommit:        c623d1b36f09f8ef6536a057bd658b3aa8632828
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

What am I missing?

Also, when I first shell into the node, or a pod actually, the k9s screen doesn't show the shell until after I press another key. I don't remember that happening before. 🤔

@derailed
Copy link
Owner

derailed commented May 4, 2021

@yogeek @gitfool - Thank you both! Think I've missed it in the last drop. Let's try this again with feelings on v0.24.9. Tx!!

@derailed derailed closed this as completed May 4, 2021
@gitfool
Copy link

gitfool commented May 4, 2021

@derailed it works now; thanks!

@derailed
Copy link
Owner

derailed commented May 4, 2021

@gitfool Woot! Cool! Thank you for reporting back and sorry for the mess up earlier ;(

@yogeek
Copy link
Author

yogeek commented May 4, 2021

Great ! Thanks @derailed 👍

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

3 participants