Skip to content

Helm v3 getting current-context wrong #7539

Closed

Description

@KlavsKlavsen

If I run: kubectl config current-context - I get the correct cluster.
My KUBECONFIG=/home/klavs/.kube/microk8s:/home/klavs/.kube/t-boss-ca:/home/klavs/.kube/p-boa-kube-ca

but helm picks the wrong cluster. Thats VERY dangerous - when your kubectl config current-context says you're working on a different cluster (and my PS1 shows that as the active one as well)..

If I run helm - pointing to the cluster config file I want it to select like this - it works:
KUBECONFIG=/home/klavs/.kube/t-boss-ca helm ls

Activity

  1. KlavsKlavsen commented on Feb 6, 2020

    @KlavsKlavsen
    Author

    When I use multiple config files - and then use kubectl to set current-context - it ONLY updates the first file.. as the other files in the KUBECONFIG path - actually had invalid "current-context" - due to that context being renamed (by kubectl).. which means - that the individual files (as being used in my work-around above) - can become invalid - and in that case helm just not say the KUBECONFIG is invalid - it simply tries to connect to localhost:8080 instead..

    This indicates that kubectl is merging KUBECONFIG files - and letting current-context be set by the first file in the path (and not overriden later) - whereas helm appearently does something else.

  2. KlavsKlavsen commented on Feb 6, 2020

    @KlavsKlavsen
    Author

    it seems helm ALWAYS chooses the FIRST configfile in KUBECONFIG - and only works on that - completely ignoring the otherfiles - and also ignoring current-context.. :(

  3. mattfarina commented on Feb 6, 2020

    @mattfarina
    Collaborator

    @KlavsKlavsen The detection of the Kubernetes configuration happens via imports from packages put out by Kubernetes. With that in mind... can you share the version of Helm you're using. We need that to trace where this issue is happening in either a dependency or our use of a dependency. On a first pass in Helm v3 I didn't see an issue. Doesn't mean it's not there but more information would help me figure out what's going on.

  4. KlavsKlavsen commented on Feb 7, 2020

    @KlavsKlavsen
    Author

    Sorry.. its v3.0.2

  5. added
    bug
    and removed on Apr 22, 2020
  6. adamreese commented on Apr 22, 2020

    @adamreese
    Member

    I started looking into this issue yesterday and did find some issues with how we loading the kubeconfig. I'll work on a patch when I find the exact issue.

  7. self-assigned this
    on Apr 22, 2020
  8. added 2 commits that reference this issue on Apr 23, 2020
    4b5248c
    4a0dfbe
  9. added a commit that references this issue on May 8, 2020
    f68c282
  10. added a commit that references this issue on Oct 2, 2020
    231b53d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions