Open varuzam opened 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
+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.
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.
#!/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
two years .... - i also really need it
My solution:
This seems good enough?
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
.
I would pay for that feature.
I would also spend some money to the developer of this feature.
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 You can use the $NAME variable to get the node name.
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
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.
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