{"record":{"id":"e47fa7af072800ee","repo":"kubernetes/kops","slug":"error-building-public-ip-options-v","errorCode":null,"errorMessage":"error building public ip options: %v","messagePattern":"error building public ip options: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/awsmodel/spotinst.go","lineNumber":323,"sourceCode":"\t\treturn fmt.Errorf(\"error building ssh key: %v\", err)\n\t}\n\n\t// Load balancers.\n\tgroup.LoadBalancers, group.TargetGroups, err = b.buildLoadBalancers(c, ig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building load balancers: %v\", err)\n\t}\n\n\t// User data.\n\tgroup.UserData, err = b.BootstrapScriptBuilder.ResourceNodeUp(c, ig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building user data: %v\", err)\n\t}\n\n\t// Public IP.\n\tgroup.AssociatePublicIPAddress, err = b.buildPublicIPOpts(ig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building public ip options: %v\", err)\n\t}\n\n\t// Subnets.\n\tgroup.Subnets, err = b.buildSubnets(ig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building subnets: %v\", err)\n\t}\n\n\t// Capacity.\n\tgroup.MinSize, group.MaxSize = b.buildCapacity(ig)\n\n\t// Monitoring.\n\tgroup.Monitoring = ig.Spec.DetailedInstanceMonitoring\n\n\t// Tags.\n\tgroup.Tags, err = b.buildTags(ig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building cloud tags: %v\", err)","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/awsmodel/spotinst.go#L305-L341","documentation":"buildElastigroup calls b.buildPublicIPOpts to decide group.AssociatePublicIPAddress from the instance group's subnets. This wrapper fires when that derivation fails, e.g. the subnets referenced by the instance group cannot be resolved consistently into public/private placement, so the Spotinst group cannot be configured.","triggerScenarios":"`kops update cluster` with Spotinst where an instance group's spec.subnets reference subnet names that don't exist in the cluster spec or mix subnet kinds so no consistent public-IP setting can be computed.","commonSituations":"Typo in subnet names under spec.subnets; instance groups edited by hand referencing subnets removed from cluster.spec.subnets; mixed utility/private subnet lists on one IG.","solutions":["Check the wrapped inner error for the exact subnet resolution failure.","Confirm every name in ig.spec.subnets exists in cluster.spec.subnets (`kops get cluster -oyaml`).","Use only 'utility' subnets for groups that need public IPs and private subnets otherwise; don't mix.","Re-run `kops update cluster` after fixing the instance group spec."],"exampleFix":"// before\nspec:\n  subnets: [us-east-1a, nonexistent-1b]\n// after\nspec:\n  subnets: [utility-us-east-1a, utility-us-east-1b]","handlingStrategy":"validation","validationCode":"clusterSubnets := map[string]bool{}\nfor _, s := range cluster.Spec.Subnets { clusterSubnets[s.Name] = true }\nfor _, n := range ig.Spec.Subnets {\n  if !clusterSubnets[n] {\n    return fmt.Errorf(\"instance group %s references unknown subnet %q\", ig.Name, n)\n  }\n}","typeGuard":null,"tryCatchPattern":"if err := kopsUpdate(); err != nil {\n  if strings.Contains(err.Error(), \"error building public ip options\") {\n    // reconcile ig.spec.subnets with cluster.spec.subnets and retry\n  }\n}","preventionTips":["Only use 'utility' subnets for groups that need public IPs.","Don't mix public and private subnet types on one instance group.","Regenerate instance groups from templates instead of hand-editing subnet lists."],"tags":["aws","subnets","spotinst","networking"],"backgroundTag":"subnet-resolution-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}