kubernetes/kops · error

found %d instances with name: %s

Error message

found %d instances with name: %s

What it means

RenderOpenstack returns this when the ServerGroup scale-down found an instance matching the instance-group name prefix but the count is not exactly 1 — the task only safely deletes when a single candidate exists. It is a deliberate safety check against deleting the wrong instance (e.g. 0 means the target was already gone, >1 means ambiguous name matches).

Source

Thrown at upup/pkg/fi/cloudup/openstacktasks/servergroup.go:200

						val, ok = server.Metadata[openstack.TagKopsName]
						if ok {
							metadataName = val
						}
						// name or metadata tag should match to instance name
						// this is needed for backwards compatibility
						if server.Name == instanceName || metadataName == instanceName {
							instances = append(instances, server)
						}
					}

					if len(instances) == 1 {
						klog.V(2).Infof("Openstack task ServerGroup scaling down instance %s", instanceName)
						err := t.Cloud.DeleteInstanceWithID(instances[0].ID)
						if err != nil {
							return fmt.Errorf("Could not delete instance %s: %v", instanceName, err)
						}
					} else {
						return fmt.Errorf("found %d instances with name: %s", len(instances), instanceName)
					}
					currentLastIndex -= 1
				}
			}
		}
		return nil
	}

	klog.V(2).Infof("Openstack task ServerGroup::RenderOpenstack did nothing")
	return nil
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. List servers with 'openstack server list' and manually delete the surplus/obsolete instance so exactly one remains, then re-run kops update.
  2. Ensure instance-group/cluster names are not prefixes of one another, or increase distinctiveness of the IG name.
  3. Check metadata k8s=<clusterName> on the instances — mislabeled/duplicated instances outside the cluster should be removed manually.
  4. If 0 instances found (already deleted), simply re-run 'kops update cluster --yes' to converge state.

Example fix

// avoid prefix collisions by naming IGs distinctly
// before
igName = "nodes"        // matches nodes-a, nodes-b
// after
igName = "nodes-prod-eu" // unique prefix
Defensive patterns

Strategy: validation

Validate before calling

# Ensure exactly one match before scale-down, mirroring the task's invariant
count=$(openstack server list --name "^${igName}" -f value | wc -l)
[ "$count" -eq 1 ] || echo "expected 1 instance named ${igName}, found $count — reconcile manually"

Prevention

When it happens

Trigger: Scale-down loop (changes.IGMap) where the regex Name filter '^<igName>' matched 0 or 2+ servers with metadata k8s == clusterName for the target instance name. Zero matches when the instance was already deleted externally; multiple matches when instance names share a prefix (e.g. nodes.cluster-a and nodes.cluster-a-b) or duplicates exist from a previous failed scale-down.

Common situations: Cluster name is a prefix of another cluster's instance-group names, so the '^name' regex over-matches; leftover duplicate instances from an interrupted roll; manual instance creation with a colliding name; the instance was already deleted by an autoscaler (0 matches).

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/6fedfba7f9b1356c. Report an issue: GitHub.