{"record":{"id":"86a280972bb69e75","repo":"kubernetes/kops","slug":"error-creating-cloud-instance-group-member-v-86a280","errorCode":null,"errorMessage":"error creating cloud instance group member: %v","messagePattern":"error creating cloud instance group member: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstack/server_group.go","lineNumber":120,"sourceCode":"\t\treturn nil, err\n\t}\n\tfor _, instance := range instances {\n\t\tif !InstanceInClusterAndIG(instance, cluster.Name, ig.Name) {\n\t\t\tcontinue\n\t\t}\n\n\t\tigObservedGeneration := instance.Metadata[INSTANCE_GROUP_GENERATION]\n\t\tclusterObservedGeneration := instance.Metadata[CLUSTER_GENERATION]\n\t\tobservedName := fmt.Sprintf(\"%s-%s\", clusterObservedGeneration, igObservedGeneration)\n\t\tgenerationName := fmt.Sprintf(\"%d-%d\", cluster.GetGeneration(), ig.Generation)\n\n\t\tstatus := cloudinstances.CloudInstanceStatusUpToDate\n\t\tif generationName != observedName || instance.Status == errorStatus {\n\t\t\tstatus = cloudinstances.CloudInstanceStatusNeedsUpdate\n\t\t}\n\t\tcm, err := cg.NewCloudInstance(instance.ID, status, nodeMap[instance.ID])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error creating cloud instance group member: %v\", err)\n\t\t}\n\n\t\tif instance.Flavor[\"original_name\"] != nil {\n\t\t\tcm.MachineType = instance.Flavor[\"original_name\"].(string)\n\t\t}\n\n\t\tip, err := GetServerFixedIP(&instance, instance.Metadata[TagKopsNetwork])\n\t\tif err != nil {\n\t\t\tklog.Warningf(\"Unable to find fixed ip for %s: %v\", instance.Name, err)\n\t\t}\n\n\t\tcm.PrivateIP = ip\n\t\tcm.Roles = []string{instance.Metadata[\"KopsRole\"]}\n\t\tcm.State = cloudinstances.State(instance.Status)\n\t}\n\treturn cg, nil\n}\n","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstack/server_group.go#L102-L138","documentation":"In osBuildCloudInstanceGroup, each Nova instance matching the instance group is converted into a cloudinstances.CloudInstanceGroup member via cg.NewCloudInstance. If that in-memory construction fails (e.g. the member would be a duplicate ID or the group state is inconsistent), kOps wraps it as \"error creating cloud instance group member: %v\" and aborts building the cloud instance group used by rolling-update/drain operations.","triggerScenarios":"cg.NewCloudInstance(instance.ID, status, nodeMap[instance.ID]) returns an error — typically when two Nova instances share the same ID within the group, or the underlying CloudInstanceGroup is in a state that forbids adding the member (e.g. adding a detached/unknown member where the API requires an existing group member).","commonSituations":"Duplicate Nova instance IDs returned by a buggy listing or reused server group; stale kOps state where the same instance appears in two instance groups; instances with inconsistent kops-instance-group metadata causing the same member to be added twice during a rolling update.","solutions":["Inspect the wrapped error from NewCloudInstance to identify the duplicate/inconsistent member ID.","List the Nova servers with the group's name prefix ('openstack server list --name ^<ig-name>') and delete or fix duplicate/stale instances.","Verify each instance's kops metadata (KopsInstanceGroup/cluster tags) so instances map to exactly one instance group.","Refresh cluster state (kops update/reconcile) so nodeMap and generation metadata are consistent, then re-run the operation."],"exampleFix":"// before: same Nova server tagged for two instance groups\n// metadata: {\"KopsInstanceGroup\": \"nodes\", \"KopsRole\": \"node\"} but listed under 'masters' prefix too\n// after: fix instance metadata so it belongs to one group\nopenstack server set --property KopsInstanceGroup=nodes <server-id>\n// or delete the orphaned duplicate instance\nopenstack server delete <duplicate-server-id>","handlingStrategy":"validation","validationCode":"// Detect duplicate Nova instance IDs for the group before building members\nseen := map[string]bool{}\nfor _, inst := range instances {\n\tif seen[inst.ID] {\n\t\treturn fmt.Errorf(\"duplicate Nova instance %s reported for instance group %s; fix stale instances before rolling update\", inst.ID, ig.Name)\n\t}\n\tseen[inst.ID] = true\n}","typeGuard":null,"tryCatchPattern":"cg, err := osBuildCloudInstanceGroup(cloud, cluster, ig, nodeMap)\nif err != nil {\n\tif strings.Contains(err.Error(), \"error creating cloud instance group member\") {\n\t\t// member construction failed: inspect and repair instance metadata/duplicates, then retry\n\t\tklog.Errorf(\"failed building group %s: %v — run 'openstack server list --name ^%s' to find stale instances\", ig.Name, err, ig.Name)\n\t}\n\treturn err\n}","preventionTips":["Ensure each Nova instance's kops metadata (instance group/role tags) points at exactly one instance group.","Delete orphaned/stale Nova servers before rolling updates.","Avoid reusing instance IDs or manually editing kops instance metadata.","Reconcile cluster state so nodeMap and instance-group generations stay consistent."],"tags":["openstack","instance-group","rolling-update","cloudinstances"],"backgroundTag":"duplicate-cloud-instance-member","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"}