k9s icon indicating copy to clipboard operation
k9s copied to clipboard

Enable nodeShell by default

Open varuzam opened this issue 4 years ago • 12 comments

Is your feature request related to a problem? Please describe. I have many k8s clusters and it is really inconvenient to enable nodeshell each time for a new cluster.

Describe the solution you'd like Enable nodeShell by default or make it configurable via a global config parameter

varuzam avatar Dec 23 '20 11:12 varuzam

+1 I create new dev clusters on a daily basis - it would be much nicer to have a global config for enabling the nodeShell and controlling the shellPod settings

day1118 avatar Jun 30 '21 02:06 day1118

+1 same for portForwardAddress. I believe working with many clusters is not something unusual these days :) k9s really lack of global config for each cluster.

andrewkaczynski avatar Sep 09 '21 15:09 andrewkaczynski

The Node Shell is very handy, but unfortunately in an environment where you often change the KUBECONFIG quite fiddly. To be able to set a flag at startup would be a huge comfort win.

Zaunei avatar Nov 25 '21 11:11 Zaunei

#!/usr/bin/env bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

pushd "$DIR" > /dev/null
yq e '.k9s.clusters.[].shellPod.command = ["/usr/sbin/chroot"]' -i config.yml
yq e '.k9s.clusters.[].shellPod.args = ["/host"]' -i config.yml
yq e '.k9s.clusters.[].featureGates.nodeShell = true' -i config.yml
popd

this can be used for a temp solution

caoer avatar Dec 19 '21 17:12 caoer

two years .... - i also really need it

genofire avatar Apr 12 '23 22:04 genofire

My solution:

  • Install https://github.com/kvaps/kubectl-node-shell
  • Create a k9s plugin for it.

This seems good enough?

snippins avatar Aug 17 '23 18:08 snippins

In light of the new config handling since v0.30 I would also love to have the possibility to set defaults for all cluster config properties globally. Either in config.yaml or separately in a $XDG_CONFIG_HOME/k9s/cluster-defaults.yaml.

norman-zon avatar Jan 09 '24 09:01 norman-zon

I would pay for that feature.

guettli avatar Mar 27 '24 16:03 guettli

I would also spend some money to the developer of this feature.

wrenix avatar Mar 27 '24 16:03 wrenix

My solution:

  • Install https://github.com/kvaps/kubectl-node-shell
  • Create a k9s plugin for it.

This seems good enough?

@snippins , do you mind sharing an example? From the quick look at k9s plugins doc there was no $NODE variable, which seems essential.

fnikolov avatar Apr 19 '24 07:04 fnikolov

@fnikolov You can use the $NAME variable to get the node name.

snippins avatar Apr 21 '24 13:04 snippins

Thank you @snippins , for the benefit of other this is what I did.

cat ~/.config/k9s/plugins.yaml
plugins:
  kubectl-node_shell:
    shortCut: Ctrl-N
    confirm: false
    description: "Shell <node_shell>"
    scopes:
      - node
    command: kubectl-node_shell
    background: false
    args:
      - $NAME

fnikolov avatar Apr 22 '24 09:04 fnikolov