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

snap helm cannot read configs #10

ryan-peachey-seon opened this issue Nov 22, 2017 · 16 comments

snap helm cannot read configs #10

ryan-peachey-seon opened this issue Nov 22, 2017 · 16 comments


Copy link

There seems to be something weird with the snap version of helm as it's not properly reading cluster configs. The default via environment config is ignored, and even the manually specified parameter is also ignored.

config location:
Specific: ~/.kube/dev-k8s
Generic: ~/.kube/<env>-k8s

Environment Variable set:



$ sudo snap refresh helm --edge
helm (edge) 2.6.2 from 'snapcrafters' refreshed
$ which helm

but the helm app is completely broken without forcing a single config file in a single location?

$ helm version
Please copy Kubernetes config to /home/rpeachey/snap/helm/common/kube/config.

This completely ignores the env variable KUBECONFIG and also completely ignores the --kubeconfig parameter introduced in what I believe was v 2.6.1

$ helm --kubeconfig ~/.kube/dev-k8s version
Please copy Kubernetes config to /home/rpeachey/snap/helm/common/kube/config.

When I manually install helm from tgz, this non-default configuration is not required

$ mkdir helm && cd helm
$ wget
$ tar -zxvf helm-v2.6.2-linux-amd64.tar.gz
$ cd ~ && mkdir bin
$ ln -sf ~/helm/linux-amd64/helm ~/bin/helm

helm just works with my config via environment variable

$ helm init
Creating /home/rpeachey/.helm 
Creating /home/rpeachey/.helm/repository 
Creating /home/rpeachey/.helm/repository/cache 
Creating /home/rpeachey/.helm/repository/local 
Creating /home/rpeachey/.helm/plugins 
Creating /home/rpeachey/.helm/starters 
Creating /home/rpeachey/.helm/cache/archive 
Creating /home/rpeachey/.helm/repository/repositories.yaml 
$HELM_HOME has been configured at /home/rpeachey/.helm.

Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.
Happy Helming!
$ helm version
Client: &version.Version{SemVer:"v2.6.2", GitCommit:"be3ae4ea91b2960be98c07e8f73754e67e87963c", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.6.2", GitCommit:"be3ae4ea91b2960be98c07e8f73754e67e87963c", GitTreeState:"clean"}
Copy link

Hi @ryan-peachey-seon,

To my knowledge of Snapd, even with the home plug, snapped apps cannot read hidden dirs and files. A workaround would be to set $KUBECONFIG to a non-hidden directory.

Copy link

@joedborg That doesn't sound right. kubectl is also installed through snap and it doesn't seem to have any issues accessing the specified config file(s). That being said, I'm not 100% sure that I've only ever used the snap kubectl binary and not inadvertently used a different binary that happened to get installed outside of snap. I'll keep an eye out going forward to see if I can confirm this or not.

Copy link

Same issue here with helm v2.7.2, Kubectl installed with snap can access ~/.kube/config.

Is this because helm confinment is set to strict whereas kubectl confinment is set to classic ?
Do you plan to fix the issue ?

± snap info --verbose helm
name:      helm
summary:   The Kubernetes package manager
publisher: snapcrafters
license:   unknown
description: |
  Helm is a tool for managing Kubernetes
  charts. Charts are packages of
  pre-configured Kubernetes resources.
snap-id: VY12auPDSljUlac4CZaOdMExw7IASsgB
  - helm
  private:           false
  confinement:       strict
  devmode:           false
  jailmode:          false
  trymode:           false
  enabled:           true
  broken:            false
  ignore-validation: false
tracking:            stable
installed:           2.7.2 (26) 9MB 
refreshed:           2017-11-28 13:13:52 +0100 CET
  stable:            2.7.2 (26) 9MB -
  candidate:         2.7.2 (26) 9MB -
  beta:              2.7.2 (26) 9MB -
  edge:              2.7.2 (26) 9MB -

Copy link

joedborg commented Mar 7, 2018

Hi @FredericLeroy, @ryan-peachey-seon,

I have opened to get the snap moved to classic confinement as I agree that it should be as kubectl.

Copy link

jcassee commented Jul 1, 2018

After installing using --classic, calling helm without the wrapper seems to work fine. No need for ~/snap/helm/common/kube/config.

Envek added a commit to Envek/helm that referenced this issue Aug 4, 2018
Helm should be packaged as classic snap (as kubectl snap does)
to be able to access kubectl configurations in `~/.kube/config`.

Already approved at

Fixes snapcrafters#10
Copy link

zub0r commented Aug 9, 2018

sudo snap install --classic helm didn't help, does this need to be merged first?

Copy link

sudo snap install --classic helm didn't work. I gave up trying Snap and used the Script installation instead, works fine.

Copy link

plallin commented Aug 14, 2018

The issue does not seem fixed indeed.

$ snap install helm --classic
helm 2.9.1 from 'snapcrafters' installed
$ helm 
Please copy Kubernetes config to /home/pauline/snap/helm/common/kube/config.

Downloading the binaries and placing them in your path works fine though.

Copy link

mhjort commented Aug 23, 2018

Same issue here

Copy link

Oblynx commented Aug 29, 2018

same here

Copy link

here as well. Finally just copied the file in desperation, but this is a serious pain in the neck.

Copy link

This is still an issue in 2.9.1 Helm, on both Stable and Edge. Why was this closed?

Copy link

My current workaround for this:

sudo snap install helm --classic
ln -s /home/$(whoami)/.kube/config /home/$(whoami)/snap/helm/common/kube/config

Copy link

This is still an issue in 2.9.1 Helm, on both Stable and Edge. Why was this closed?

This isn't closed. The reference above your comment is for another repository by jonashackt having to do with Ansible.

Copy link

Snap has been classic for a while, so closing. If this is still an issue for anyone, please speak up and I'll reopen.

Copy link

Hello @joedborg ! I just encountered this issue in a weird fashion today.

With the latest (version.BuildInfo{Version:"v3.5.4", GitCommit:"1b5edb69df3d3a08df77c9902dc17af864ff05d1", GitTreeState:"clean", GoVersion:"go1.15.11"}) helm (and snap) version, helm still failed silently with error code 1 on snap install.

However, the issue only occurred when I ran helm through the child_process typescript library.

Uninstalling the snap, and using helm's version from the provided install script fixed the issue ; meaning the problem does originate from the snap.

Below is the code that yielded problems using the snap:

const namespace = "default";
const release = "test";
const command = "helm";
const args = ["get", "values", "-n", namespace, release, "-o", "json"];
// NOTE: Manually adding the kube context in the parameters did not work since my kubeconfig is stored in the default ~/.kube/config location.
const output = child_process.spawnSync(command, args);

// DEBUG: These 2 members are empty

if (output.error !== undefined) {
    console.error(`${command} ${args.join(' ')} failed. Reason: ${output.error}`);
    throw output.error;
if (output.status !== 0) {
    console.error(`${command} ${args.join(' ')} failed with code: ${output.status}`);
    throw new Error(`code: ${output.status}`);

return output.stdout.toString();

I would like to emphasize, running the exact same command directyl from the terminal worked just fine. I did not try Ricardo's workaround as I only stumbled upon this after changing my helm install.

I do not have any idea what the problem may be here. Please tell me if I should open a new issue (all of the relevant details should be here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests