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

Issues running with Alpine/Docker #31

Open
nbhargava opened this issue Feb 24, 2020 · 3 comments
Open

Issues running with Alpine/Docker #31

nbhargava opened this issue Feb 24, 2020 · 3 comments
Assignees

Comments

@nbhargava
Copy link

Describe the bug
In a docker container when initializing the k8s provider with values from a GKE instance generated by terraform, the provider will attempt to connect to a kubernetes cluster at localhost.

Steps to reproduce the issue:
See https://github.com/nbhargava/terraform-k8s-alpine. After plugging in a real GCP project name in main.tf and storing credentials in ./creds:

  • Running terraform plan succeeds normally (at least on macOS)
  • Running docker build . fails

The error given is:

Error: Failed to configure: Get http://localhost/api?timeout=32s: dial tcp 127.0.0.1:80: connect: connection refused

  on main.tf line 45, in provider "k8s":
  45: provider "k8s" {

Expected behavior
docker build . should succeed and not try to connect to a cluster before the host/token/certificate are known. At the very least, the behavior should be consistent across all platforms. I also tried changing from an Alpine based image to Debian Stretch, but the docker-based approach still failed.

@sagikazarmark
Copy link
Member

Do you have the same versions of the provider locally and in docker?

Can you please try the latest stable version: https://github.com/banzaicloud/terraform-provider-k8s/releases/tag/v0.7.2

Recently, we've rewritten the provider to connect clusters the same way as the official kubernetes provider does.

@nbhargava
Copy link
Author

Bumped terraform in both places to 0.12.21 just to be sure.

The problem is the same using the pre-built binaries (again just checking macOS vs alpine docker). Updated code at the previously linked repo.

@DesmondH0
Copy link

I have the same issue with the plugins as below:

Terraform v0.12.23
+ provider.google v3.13.0
+ provider.helm v1.1.0
+ provider.k8s v0.7.4
+ provider.kubernetes v1.11.1

@bonifaido bonifaido self-assigned this Mar 23, 2020
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

No branches or pull requests

4 participants