kubernetes/kops · error
error creating TargetPool %q: %v
Error message
error creating TargetPool %q: %v
What it means
When a TargetPool needs to be created (actual == nil), RenderGCE calls TargetPools().Insert and wraps any immediate API error in this message. It means GCE rejected the creation request synchronously.
Source
Thrown at upup/pkg/fi/cloudup/gcetasks/targetpool.go:96
func (e *TargetPool) URL(cloud gce.GCECloud) string {
name := fi.ValueOf(e.Name)
return fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%s/regions/%s/targetPools/%s", cloud.Project(), cloud.Region(), name)
}
func (_ *TargetPool) RenderGCE(t *gce.GCEAPITarget, a, e, changes *TargetPool) error {
name := fi.ValueOf(e.Name)
o := &compute.TargetPool{
Name: name,
}
if a == nil {
klog.V(4).Infof("Creating TargetPool %q", o.Name)
op, err := t.Cloud.Compute().TargetPools().Insert(t.Cloud.Project(), t.Cloud.Region(), o)
if err != nil {
return fmt.Errorf("error creating TargetPool %q: %v", name, err)
}
if err := t.Cloud.WaitForOp(op); err != nil {
return fmt.Errorf("error creating TargetPool: %v", err)
}
} else {
return fmt.Errorf("cannot apply changes to TargetPool: %v", changes)
}
return nil
}
type terraformTargetPool struct {
Name string `cty:"name"`
HealthChecks []*terraformWriter.Literal `cty:"health_checks"`
}
func (_ *TargetPool) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *TargetPool) error {View on GitHub (pinned to 4c8573c808)
Solutions
- Check target pool quota: `gcloud compute target-pools list` and project quotas
- Verify no name conflict with an existing target pool in the region
- Confirm IAM permissions (compute.targetPools.create)
- Inspect the wrapped error with -v=10 for the exact API rejection
- Retry if the failure was transient
Defensive patterns
Strategy: validation
Validate before calling
gcloud compute target-pools list --filter="name=<name> AND region=<region>" --format='value(name)'
Try / catch
if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 409 { /* name conflict: adopt or rename */ } Prevention
- Monitor target pool quota in the region
- Avoid manually creating resources with kOps-managed names
- Verify region is valid and enabled for the project
When it happens
Trigger: TargetPools().Insert(project, region, o) returns an error: invalid target pool definition, quota exceeded (target pools per project/region), duplicate name conflict, or IAM/API failure.
Common situations: Exceeding the GCP target-pool quota in a region with many legacy LBs; name collision with a manually created target pool; inserting into a region that doesn't exist or isn't enabled for the project; permission denied after IAM tightening.
Related errors
- error getting TargetPool %q: %v
- error creating TargetPool: %v
- cannot apply changes to TargetPool: %v
- creating gce IPAM controller: %w
- error building compute API client: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/146bd61b7a6aaae7.
Report an issue: GitHub.