Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

k9s doesn't honor KUBECONFIG environment variable when replacing value for plugin #2862

Merged
merged 1 commit into from
Nov 28, 2024

Conversation

rvarunrathod
Copy link
Contributor

@rvarunrathod rvarunrathod commented Sep 1, 2024

k9s does not utilize the KUBECONFIG environment variable, when flag value of --kubeconfig is empty.

I am using plugin that will copy log command to clipboard.
The plugin

plugins:
 logs-kubectl-cmd:
   shortCut: Ctrl-L
   confirm: false
   description: Copy log cmd to clipboard
   scopes:
     - pods
   background: true
   command: bash
   args:
     - -c
     - "echo kubectl logs -f $COL-NAME -n $NAMESPACE --context $CONTEXT --kubeconfig $KUBECONFIG | pbcopy"

when I added logger here I found that value of *kcfg is empty

var cfg string
kcfg := c.Flags().KubeConfig
if kcfg != nil && *kcfg != "" {
  cfg = *kcfg
  log.Info().Msg(fmt.Sprintf("Here is the KUBECONFIG, %v, %v", kcfg, cfg))
}

logs

12:12AM INF Here is the KUBECONFIG, 0x14000c6f200,

Copy link
Owner

@derailed derailed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rvarunrathod Nice catch! Thank you for this update.

@derailed derailed merged commit c9ad95a into derailed:master Nov 28, 2024
2 checks passed
thorbenbelow pushed a commit to thorbenbelow/k9s that referenced this pull request Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants