Skip to content

Conversation

@vandycknick
Copy link

@vandycknick vandycknick commented Dec 9, 2025

My previous PR got auto closed, I can't reopen it AFAIK, so am bringing this back and hopefully this can be merged: #3568

original message:

This proposal introduces a new forwardInterrupt setting in the plugin config. When enabled, this setting sends the interrupt signal (such as CTRL+C) to the plugin itself, rather than allowing k9s to handle it and terminate the plugin. Initially, I considered naming it exitOnInterrupt, but that would imply the default action is to exitOnInterrupt and as such the value will default to true, which would require broader changes. I set that idea aside for now to keep the scope focused on allowing interrupt forwarding.

Why do I think it is useful? I have a couple of plugins that launch a shell from k9s as I use k9s as an overall dashboard to inspect all aspects of a k8s cluster. One example is a plugin that, on the node view, can start a shell on the node. It detects an EC2 or GCP VM and uses the correct tooling to launch a shell. However, at the moment, if I type CTRL+C in this shell, k9s sends the interrupt signal and will terminate the plugin. Hence, why I propose this flag: so I can suppress that and, instead, use CTRL+D with an EOF signal or just rely on typing exit to terminate the plugin.

For example, the following plugin allows you to hop on an EC2 node via SSM:

plugins:
  ec2-shell:
    shortCut: s
    confirm: false
    description: "Shell <node>"
    scopes:
      - node
    command: bash
    background: false
    forwardInterrupt: true
    args:
      - -c
      - >-
        kubectl-ec2 --context $CONTEXT --profile "${PROFILE:-$AWS_PROFILE}" --node $NAME

kubectl-ec2 is a custom script that can determine the correct AWS environment based on the plugin context. My personal implementation lives here https://github.com/vandycknick/dotfiles/blob/1efa25fd6c4818b3267bb2029bdc254dd2f78814/.local/bin/kubectl-ec2 and can be different depending on your preference. The important part here is the forwardInterrupt: true as that will send the CTRL+C signal into the shell launched by SSM instead of k9s handling the signal and killing the remote session.

The following adds a plugin config setting that allows plugins to
define that they would like to receive the Interrupt signal. This
can be usefull in cases where a plugin starts a shell (bash, fish, ...)
and rather want's to handle the interrupt instead of having k9s
exit the process.
@github-actions
Copy link

github-actions bot commented Jan 9, 2026

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Jan 9, 2026
@vandycknick
Copy link
Author

Anything I can do to get this merged in?

@github-actions github-actions bot removed the stale label Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant