-
Notifications
You must be signed in to change notification settings - Fork 881
stage0: attach to the app's stdin/stdout/stderr #1799
Comments
So you're looking for something analogous to a screen/tmux attach to the pty of the running app? I don't think systemd implements that functionality today, but I could be wrong. |
Can Kubernetes get the past stdout as well, or are we only interested in the stdout from the moment we attach to the app? |
I also don't think systemd implements that functionality. I asked on systemd/systemd#2069. |
@alban The |
So, option 1 of TTYPath above.. I did some quick prototyping: I ran this perl script: #!/usr/bin/perl
use IO::Pty;
use Fcntl;
my $pty = new IO::Pty;
fcntl $pty, F_SETFD, 0; # clear close-on-exec
system "urxvt -pty-fd " . (fileno $pty) . "&";
close $pty;
printf("tty: slave %s, master %s\n", $pty->slave->ttyname(), $pty->ttyname());
sleep 999 And then this systemd unit:
Before starting the unit, I created a bindmount for my pts over to my alpine-root. I also had to fiddle with my proc mount. That gave me what I expected; a running 'sh' process which the new perl-spawned urxvt could talk to, where the I propose that from there, there follow two ways to implement option 1: User-heavy manual attachWe could allow a user to specify effectively It would then be up to the user to drain, manage, and attach using this pts. We would document that the First-class rkt attachWe could also create a more first class integration where rkt adds a The stage1-pty-helper provides an interface that allows a new first-class rkt command The first of these options is more flexible, but will not be generally usable by a cli-user, and will also require any system that does with to use it to do some heavy lifting. I think either option is reasonable.. but most of all I think we should decide on one of the two to go with it so long as we can all agree there isn't a better option and there isn't a problem with this one. I know @yifan-gu was looking at some prototyping related to this stuff, so I'd like him to throw in an opinion, as well as @lucab, and if both of you can agree on a specific approach, let's get going on implementing. @lucab, if you can figure out if @alepuccetti is the right person to own this or if there's a better person, that would be awesome! |
@lucab missed your comment for a second: my take on your options
Sorry for missing your comment for a bit and adding a giant wall of text that duplicates a chunk of what you said! |
@euank thanks for the feedback. I'm going with option 1, while leaving an open window for option 2 for later (once we have a working PoC on our side we can re-discuss systemd details). I'm dropping option 3 for the moment. I'm starting from stage1/stage2 internals, hoping to have something crude and working at the low level. Once there, I'll gather some more feedback before implementing host integration (k8s and stage0) which also includes a decision on |
I have a very crude ttymux service (based on However, it looks like the requirements from kubernetes are much more complex and require being able to attach either to a tty (ie. a single in/out stream plus a control back-channel) or to every single stream separetely (ie. separate stdin/stdout/stderr channels). See kubernetes/kubernetes#32869 for all the details. For this reason, it looks like my current PoC is not enough and we need support from systemd to be able to handle streams separately and without a tty. I just submitted a proposed implementation of this to systemd (systemd/systemd#4179). |
I'm confused as to why those systemd changes are needed. Why can't the Mind clarifying why additional iottymux code or tweaking its interface doesn't allow expressing multiple streams? |
@euank the problem is not between k8s and Systemd patching is needed in order to provide separate stdin/stdout/stderr streams to |
What is the next step on this? |
Systemd implementation is done and merged into systemd git (master, post v231): systemd/systemd#4179 According to plans, systemd v232 should have already been released but unfortunately this release seems to be taking longer than expected, so I just asked for an ad-hoc backport in order to have this available in stage1: coreos/bugs#1645 I've ported my initial PoC to a proper golang stage1 sidecar, and added a This is already rebased on top of the current CRI rework (#3318), which should land into master in this release cycle. It was already briefly demoed in the latest community sync, see recording. Next steps from here are:
|
All blockers for this should be now gone. Tracking implementation progress at #3396. |
Currently, kubernetes provides the ability to attach to the app's stdin/stdout/stderr using docker attach. It is mainly for debugging purpose.
So in order to complete the kubernetes' requirement, we would need to implement something similar, possibly by implementing in
rkt enter
, e.g.rkt enter --attach stdin --attach stdout
?Any ideas @vcaputo @jonboulle ?
The text was updated successfully, but these errors were encountered: