derailed / k9s

🐶 Kubernetes CLI To Manage Your Clusters In Style!
https://k9scli.io
Apache License 2.0
27.16k stars 1.7k forks source link

Enable nodeShell by default #1001

Open varuzam opened 3 years ago

varuzam commented 3 years ago

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

day1118 commented 3 years ago

+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

andrewkaczynski commented 3 years ago

+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.

Zaunei commented 2 years ago

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.

caoer commented 2 years ago
#!/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

genofire commented 1 year ago

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

snippins commented 1 year ago

My solution:

This seems good enough?

norman-zon commented 10 months ago

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.

guettli commented 7 months ago

I would pay for that feature.

wrenix commented 7 months ago

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

fnikolov commented 6 months ago

My solution:

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.

snippins commented 6 months ago

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

fnikolov commented 6 months ago

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
younsl commented 5 days ago

Hi, folks.

I’d like to share a concise solution to enable the nodeShell feature globally for multiple Kubernetes clusters.

Add the following command to your shell configuration file:

echo 'export K9S_FEATURE_GATE_NODE_SHELL=true' | tee -a ~/.zshrc

This allows you to use the nodeShell feature across all clusters without needing extra configurations in k9s/plugins.yaml. Using this global environment variable also means you can omit the k9s.featureGates.nodeShell setting in k9s/config.yaml. The environment variable K9S_FEATURE_GATE_NODE_SHELL=true globally overrides the feature gate option, eliminating the need to set it for each cluster.

For more details, please refer to the discussion in PR #2921.