-
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
connection refused error caused by missing 'Authorization' header in request to Kubernetes API #1152
Comments
TL;DR Here's the debug output for the failing deployment, specific to the provider REQUEST:
Compared to the working deployment, notice the Authorization:
|
I took a quick look at the output from the failing debug log. Offhand, it looks a bit like what I ran into when using the Kubernetes provider with AKS. It can be tricky to get the dependencies right when creating a cluster and creating Kubernetes resources in a single apply. It doesn't work for every scenario, and may require a work-around. Can you try using a
I'm asking because I see that We have a working example for AKS with a short guide, in case it helps to view our current limitations and work-arounds regarding stacking resources like this in a single apply. Alternatively, if you completely separate the Kubernetes resources from the cluster infrastructure resources, and use two applies, that will always work. The guide I linked above will give you the exact commands needed, but I'll post it here too:
|
@dak1n1 thanks for the response! I am aware that the recommendation is to isolate the cluster creation from the cluster configuration, but it has been working up until this point. Following your recommendation, I pulled the data object out of the module and put it in my I'm happy to close this issue now. |
Thanks for getting back to us - in that case, I'll close this issue :) |
@aareet Can we possibly reopen this issue? |
I think this is a copy of #1307 |
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! |
Terraform Version, Provider Version and Kubernetes Version
Affected Resource(s)
All Kubernetes resources deployed by Terraform.
Terraform Configuration Files
AKS module output (used by Kubernetes provider)
Deployment file main.tf
Debug Output
I have 1 deployment that's working and 4 that are failing
Failing deployment output: https://gist.github.com/taylorturner/ab4ddf84e89bd646b984019b9f35eb13
Succeeding deployment output: https://gist.github.com/taylorturner/54f608a01351a44cc2c200adeb7a0843
Steps to Reproduce
terraform plan
Expected Behavior
The kubernetes provider should be passing the Authorization header to the Kubernetes API.
Actual Behavior
It isn't doing that.
Important Factoids
Factoid 1
We're using a service principal to connect to the Azure providers. However, the AKS cluster has Azure AD RBAC integration enabled for authenticating
kubectl
. We have a 'Cluster Super Admin' AD group that's mapped to the 'cluster-admin' ClusterRole which is configured as the admin for the cluster. That's why we're using the admin context outputs.Factoid 2
We've been doing a SPIKE on leveraging Terraform Cloud. I had all my deployments working in Terraform Cloud using remote runners. Then I ran into a bug with the Terraform Cloud Private Module Registry. Since then I've been slowly unraveling the Terraform Cloud changes trying to get everything back into a working state.
As of right now, all my workspaces are configured for local execution and the modules are sourced from Github. So far the Terraform Cloud product seems much less "mature" than I was hoping for.
References
Not related to this necessarily, but I opened a bug report regarding the bug I found in Terraform Cloud. hashicorp/terraform#27695
Community Note
The text was updated successfully, but these errors were encountered: