-
Notifications
You must be signed in to change notification settings - Fork 988
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
Don't fallback to localhost cluster #1479
Comments
Thanks for opening this @ikarlashov. This seems to be the default behaviour of client-go (we don't set any explicit configuration for InCluster config, it's just what happens if no options are specified and the client is inside a cluster). I need to investigate if there is a way to disable this and make it configurable. Is the |
@jrhouston no problem :) I don't think there's such env variable. I execed to the gitlab-runner pod and there're the following k8s-related vars:
|
@ikarlashov Can you share some more information about how you are configuring the provider block in your Terraform config? After investigating it seems like you shouldn't fall back to the in-cluster config unless the provider block ends up with empty values. |
Looks like client-go uses |
facing the same issue in our own environment. Kubernetes provider is working fine with tf 0.13 but not at tf 1.0.x. It is falling back to localhost. Our cluster is AWS EKS. Used configurations :
Error : Error: Get "http://localhost/api/v1/namespaces/xxxxxxxx": dial tcp 127.0.0.1:80: connect: connection refused |
In our case, it even tries to connect to a completly different service (NoMachine webinterface). Because it runs on localhost and has a redirect. And that even when the cluster endpoint is available.
On Helm it says the following. Somehow the configuration went missing.
|
Hi Team - We have observed the related issue when the provider "kubernetes" {} block is omitted, resulting in the unexpected behavior of the provider attempting to contact localhost. For a UX standpoint an Terraform version: 1.1.6 |
How does one check the kubernetes configuration? https://www.reddit.com/r/Terraform/comments/vsme03/how_do_i_verify_the_kubernetes_provider/if25eb2/?context=3 |
I have a similar issue with kubernetes provider on a different cloud provider: the interesting part is that the provider config works fine on first run, but then on subsequent the problem lies in the exec block issue though... |
hello here! |
Marking this issue as stale due to inactivity. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. This helps our maintainers find and focus on the active issues. Maintainers may also remove the stale label at their discretion. Thank you! |
Hey, any update on this? We're also facing this issue and couldn't think of a valid solution that isn't "hacky", so we'll be glad to have this solved. |
Hi folks,
We have Gitlab-CI runners running pipeline in eks cluster. Whenever k8s provider can't establish connection to desired cluster through k8s provider config block - it falls back to localhost and trying to mess up cluster where pipeline runs. It's very dangerous behavior and should be enabled EXPLICITLY in k8s provider settings (if there's a real usecase for it).
Terraform Version, Provider Version and Kubernetes Version
Affected Resource(s)
Authentication mechanism for provider
Debug Output
Fallback to localhost:
https://gist.github.com/ikarlashov/7af79c1225e9383bd6ca135cca2e0aa3
Steps to Reproduce
Misconfigured settings for k8s in k8s provider block
Expected Behavior
Fail and error message (like it does when runs in non-k8s enviro)
Actual Behavior
Trying to mess up wrong cluster
The text was updated successfully, but these errors were encountered: