kuke attach¶
Attach to an Attachable container's sbsh terminal.
<cell> is a positional argument. --realm, --space, and --stack all default to default, so for a cell in the default location you only need the cell name.
Flags¶
| Flag | Default | Description |
|---|---|---|
--container |
(auto-pick) | Container within the cell to attach to (omit to auto-pick the only non-root attachable) |
--no-screens |
false |
Do not draw the starting and exit screens around the attach session |
--realm |
default |
Realm that owns the cell |
--space |
default |
Space that owns the cell |
--stack |
default |
Stack that owns the cell |
Plus all global flags.
Container selection¶
If the cell has exactly one non-root attachable container, --container can be omitted. Otherwise, pass --container explicitly. Containers must be marked attachable in the cell spec to be a valid target.
Attaching while a cell starts¶
You can attach before a cell is ready:
- The cell is
Pending, or the container has no running task yet.kuke attachshows a starting screen with the kukeon mark and what the cell is waiting for. It reads the cell every 500 ms and attaches as soon as the container runs.^Ccancels the wait, andkuke attachthen exits non-zero. - The container is cloning its
reposor running itsrunOn: createstages. kuketty serves a boot screen on the terminal socket. It shows the phase and the current repo or stage, and every client attached to the container sees the same screen. When setup succeeds, the session continues in the workload's terminal without any action from you. When a repo or stage fails, the screen names it and shows the error for at most 3 s, then the container exits as before.
The boot screen is on by default. Turn it off for one container with spec.containers[].tty.bootScreen: off (ContainerTty), or for the whole daemon with kukettyBootScreen: off in the ServerConfiguration (KUKEOND_KUKETTY_BOOT_SCREEN, --kuketty-boot-screen). The container's value wins. With it off, nothing answers on the terminal socket until setup is done, as before.
Screens¶
Around the session, kuke attach draws two screens of its own:
- the starting screen above, while the cell or its container is still starting;
- an exit line printed on the normal screen when the session ends, so it stays in your scrollback. It says whether you detached (the cell is still running, followed by the command that attaches again), the cell exited (with the container's exit code), the cell stopped, or the connection was lost.
The screens are off, and the output is exactly what it was without them, when:
- you pass
--no-screens; spec.attach.screensisoffin the client configuration (~/.kuke/kuke.yaml), orKUKE_ATTACH_SCREENS=offis set;- stdin or stdout is not a terminal, or
TERMisdumb.
With the screens off, a Pending cell is refused as before.
spec.attach.skipBootScreen: true (KUKE_ATTACH_SKIP_BOOT_SCREEN=true) keeps the starting screen up until the container's setup is done, then attaches straight to the workload's terminal, so you never see the boot screen. It needs the screens on.
# ~/.kuke/kuke.yaml
apiVersion: v1beta1
kind: ClientConfiguration
spec:
attach:
screens: "on" # on | off
skipBootScreen: false
The colors follow the terminal: 24-bit when COLORTERM is truecolor or 24bit, 256 colors when TERM names 256color, 16 colors otherwise, and none when NO_COLOR is set.
System notices¶
While you are attached, kuketty draws system notices over the session. They reach every client attached to the container, whether it attached with kuke attach, kuke run or --host ssh://:
| Event | Notice |
|---|---|
| Another client attaches | Toast another client attached · N attached for 4 s, on every client except the new one |
| A client detaches | Toast a client detached · N attached for 4 s, on the clients still attached |
kuke stop, kuke kill or kuke restart runs on the cell |
The stopping screen for at most 1 s, ending on stopping <cell>…, killing <cell>… or restarting <cell>…, before the session ends |
| The cell becomes OutOfSync | Toast config changed · OutOfSync: <reason> for 6 s, once per change |
Toasts are drawn in the top-right corner over the workload's output. Your keystrokes still reach the workload, and ^]^] still detaches. While the stopping screen is up, keystrokes are dropped. Afterwards the screen is redrawn as it was. The notices are never written to the workload's terminal, so kuke log, the recording and the terminal's screenshot never contain them. While the container's setup runs and the boot screen is up, there are no notices.
kuke stop, kuke kill and kuke restart wait for the stopping screen for at most 1.5 s, and only when a client is attached. A container with nobody attached costs nothing. They never fail because a notice could not be shown, for example when the container's kuketty predates the notices.
Turn the notices off:
- for your own sessions:
spec.attach.overlays: offin the client configuration, orKUKE_ATTACH_OVERLAYS=off. The terminal then sends your client no overlay bytes, and the other clients still get theirs; - for one container:
spec.containers[].tty.overlays: off(ContainerTty); - for the whole daemon:
kukettyOverlays: offin the ServerConfiguration (KUKEOND_KUKETTY_OVERLAYS,--kuketty-overlays). The container's value wins.
# ~/.kuke/kuke.yaml
apiVersion: v1beta1
kind: ClientConfiguration
spec:
attach:
overlays: "off" # on | off
The web UI never receives overlay bytes. It shows the same notices as its own toasts (see systemNotices in its settings).
Detaching¶
Press ^]^] (two consecutive Ctrl-] keystrokes) to detach cleanly. The cell keeps running and you can re-attach later with the same command.
If the workload exits or the peer hangs up, the attach loop exits and the CLI returns to your shell. With the screens on, the exit line says how the session ended.
Examples¶
# Attach to a cell in the default location
sudo kuke attach myshell
# Attach to a cell in a non-default location
sudo kuke attach wp --realm default --space blog --stack wordpress
# Explicit container in a multi-container cell
sudo kuke attach web --container debug