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

home/.kube/config: no such file or directory #402

Closed
heoelri opened this issue Feb 10, 2020 · 7 comments
Closed

home/.kube/config: no such file or directory #402

heoelri opened this issue Feb 10, 2020 · 7 comments

Comments

@heoelri
Copy link

heoelri commented Feb 10, 2020

Terraform Version

0.12.20

Affected Resource(s)

  • helm_release

Terraform Configuration Files

provider "helm" {
  kubernetes {
    host                   = azurerm_kubernetes_cluster.deployment.kube_config.0.host
    username               = azurerm_kubernetes_cluster.deployment.kube_config.0.username
    password               = azurerm_kubernetes_cluster.deployment.kube_config.0.password
    client_certificate     = base64decode(azurerm_kubernetes_cluster.deployment.kube_config.0.client_certificate)
    client_key             = base64decode(azurerm_kubernetes_cluster.deployment.kube_config.0.client_key)
    cluster_ca_certificate = base64decode(azurerm_kubernetes_cluster.deployment.kube_config.0.cluster_ca_certificate)
  }
}

data "helm_repository" "stable" {
  name = "stable"
  url  = "https://kubernetes-charts.storage.googleapis.com"
}

resource "helm_release" "nginx-ingress" {
  name       = "nginx-ingress"
  repository = data.helm_repository.stable.metadata[0].name
  chart      = "nginx-ingress"
  version    = "1.30.0"

  set {
    name  = "rbac.create"
    value = "true"
  }

  set {
    name  = "controller.autoscaling.enabled"
    value = "true"
  }

  set {
    name  = "controller.service.loadBalancerIP"
    value = "true"
  }
}

Debug Output

Panic Output

Expected Behavior

Terraform should use Helm to deploy the nginx-ingress Chart to my Azure Kubernetes Service Cluster.

Actual Behavior

Error: stat /github/home/.kube/config: no such file or directory

  on kubernetes.tf line 82, in resource "helm_release" "nginx-ingress":
  82: resource "helm_release" "nginx-ingress" {

Steps to Reproduce

terraform validate and terraform plan finish successfuly. Only the terraform apply steps fails with the error message i pasted above.

Important Factoids

  • Azure Kubernetes Service
  • Deployment using GitHub Actions

References

@eeeschwartz
Copy link

@heoelri I encountered the same issue and was able to fix the issue by manually writing the ~/.helm/config file as described in #400.

The issue also describes further issues I had with the helm config but YMMV.

@heoelri
Copy link
Author

heoelri commented Feb 10, 2020

Thanks @eeeschwartz I spent some more time on troubleshooting this. Removing all sets solved the problem so it seemed like it's not an authentication issue.

Step-by-step adding all sets back pointed to the annotations i've tried to set to configure the LB as an Internal Load Balancer. This issue helped me to fix it: #125

@heoelri heoelri closed this as completed Feb 10, 2020
@IbraheemAlSaady
Copy link

IbraheemAlSaady commented Mar 5, 2020

Just to put this out there. You need to disable loading the config file

provider "helm" {

  kubernetes {
    load_config_file = false
    ...
  }

Gotta admit, its a bit of a weird behavior because if credentials are provided, it shouldn't look at the config file. But the above is working for me

@h4wkmoon
Copy link

Same issue even with

provider "helm" {

  kubernetes {
    load_config_file = false
    ...
  }

@IbraheemAlSaady
Copy link

@h4wkmoon do you have your kubeconfig in the ~/.kube/config path?
You can also try exporting the config like: export KUBECONFIG=[path to config file]

Also, make sure this variable KUBE_LOAD_CONFIG_FILE is not set to true anywhere.

Have a look here

That's the steps I would take, I hope that helped in some way.

@h4wkmoon
Copy link

My bad, I had set an alias for the helm provider, and did not set it in every helm releases in my project.
That's an obvious pebkac.
My apologies for the time wasted and the spam.

@ghost
Copy link

ghost commented Apr 27, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants