-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Recreating google_container_node_pool fails to delete instance_template when in use by google_compute_backend_service #3838
Comments
Is there a reason you're trying to specifically create LB resources with Terraform and not with the LoadBalancer K8s service? Otherwise, I'm not sure I have a good solution. It would require some knowledge of the link between node pool and backend services that is exclusive to this situation, and we can't force replacement of the backend service when updating its list of backends. Even if we managed to find a workaround, this is bound to cause issues at some point because GKE/k8s assumes it will be managing any linked LB resources, and this breaks that pattern. @rileykarson mentioned that create_before_destroy might solve your issue but I'm not sure whether it will update the backend URLs before destroying the final node pool. |
Mostly that I am migrating / splitting some traffic to a new service that will run on GKE through an existing HTTP load balancer managed with Terraform. Is there another way to use an HTTP load balancer when not all your services are in GKE? |
I'm not sure if you'll be able to manage a HTTP load balancer properly in Terraform if it is also going to be used for k8s/GKE. Are the services (overloaded term) still k8s services? I think you could use Ingress to create the GCE HTTP(S) LB and configure it to handle traffic, though I can't say I know exactly what this looks like for your setup. |
No, sorry. I meant that we are expanding into Kubernetes and GKE. But our existing services are applications that run on instances managed in instance groups. We have existing HTTP load balancers that we use to direct traffic to these instance groups. Our hope was to be able to treat GKE in a similar way by adding the GKE instance groups to a load balancer backend. I am actually using the nginx Ingress in this scenario. But I am ignoring the I'm happy to do something else. But I am struggling to understand how someone with existing endpoints can start migrating to GKE / Kubernetes without serious traffic shuffling with intermediate load balancers. |
The more I think about this the more it seems like a feature request for GKE (probably under https://github.com/kubernetes/ingress-gce). I just tried to do a similar pattern with NEGs. But a similar issue exists in that there is no way for Terraform to know the NEGs to add them to the backend service. A data resource for NEGs wouldn't work because the NEGs can change and are created at Kubernetes runtime which won't be available when Terraform runs. The closest I could find is kubernetes/ingress-gce#33. My idea would be a controller similar to
|
Yeah, intermediate load balancers is what I was thinking of.
Yeah, we're pretty limited by what is exposed by the GKE APIs and resources - if GKE decides to add dependencies or generate new resources that we can't 'import' into Terraform, the provider is not going to handle it well, since it's essentially two infrastructure managers trying to manage the same things. If you want to file an issue against the k8s team, that would be great, since they would probably be able to provide more k8s/GKE-specific advice. |
I'm closing this as I think it is ultimately encompassed by kubernetes/ingress-gce#33. It is a broad ask but is basically the same as "allow Ingress to use an existing load balancer that has other backends and buckets". |
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! |
Community Note
Terraform Version
Affected Resource(s)
Terraform Configuration Files
I can provide additional config if this doesn't appear relevant enough.
Debug Output
https://gist.github.com/andyshinn/25d4cb0a37b9c0a5788cbfd09d58401d
Panic Output
Expected Behavior
When changing a
google_container_node_pool
that forces recreation (such as adding new scopes), the node pool should be recreated without error (possibly forcing recreation ofgoogle_container_cluster
andgoogle_compute_backend_service
).Actual Behavior
The
google_container_node_pool
fails with the following error when adding a new auth scope:Which appears due to
google_compute_backend_service
using the instance groups.Steps to Reproduce
terraform apply
google_container_node_pool
resource.terraform apply
Important Factoids
References
I think this is the same as or similar to #1000. But I didn't see any headway on that issue.
google_container_node_pool
fails because instance group persists #1000The text was updated successfully, but these errors were encountered: