kubernetes/kops · error
ig name not set on instance template %s
Error message
ig name not set on instance template %s
What it means
The final step of the legacy path reads the instance-group name from the resolved instance template's metadata (MetadataKeyInstanceGroupName). If the template exists but lacks that metadata key, kops cannot map the instance back to its instance group, so identification fails. This indicates the template was not created by kops (or was edited).
Source
Thrown at pkg/nodeidentity/gce/identify.go:177
// We now double check that the instance is indeed managed by the MIG
// this can't be spoofed without GCE API access
migMember, err := i.getManagedInstance(ctx, mig, instance.Id)
if err != nil {
return nil, err
}
if migMember.Version == nil {
return nil, fmt.Errorf("instance %s did not have Version set", instance.Name)
}
instanceTemplate, err := i.getInstanceTemplate(lastComponent(migMember.Version.InstanceTemplate))
if err != nil {
return nil, err
}
igName = getMetadataValue(instanceTemplate.Properties.Metadata, MetadataKeyInstanceGroupName)
if igName == "" {
return nil, fmt.Errorf("ig name not set on instance template %s", instanceTemplate.Name)
}
}
info := &nodeidentity.Info{}
// info.InstanceID TODO: InstanceID is only used by the provider?
tagToRole := make(map[string]kops.InstanceGroupRole)
for _, role := range kops.AllInstanceGroupRoles {
tag := gce.TagForRole(i.clusterName, role)
tagToRole[tag] = role
}
labels := make(map[string]string)
for _, tag := range instance.Tags.Items {
role, found := tagToRole[tag]
if found {
switch role {
case kops.InstanceGroupRoleControlPlane:View on GitHub (pinned to 4c8573c808)
Solutions
- Re-add the kops metadata to the template, or better: re-roll the MIG to the kops-generated instance template (kops rolling-update cluster --cloud-init).
- Verify the template with gcloud compute instance-templates describe <tmpl> --format='yaml(properties.metadata)' and confirm the instance-group-name key exists.
- Ensure the cluster was created/updated with kops so templates carry kops metadata; run kops update cluster and rolling-update.
- If using CAPI, confirm the machine template is generated by CAPG with the expected metadata.
Example fix
// before — foreign template without kops metadata igName = getMetadataValue(instanceTemplate.Properties.Metadata, MetadataKeyInstanceGroupName) // "" // after — ensure MIG uses kops template // gcloud compute instance-groups managed set-instance-template <mig> \ // --zone <zone> --instance-template <kops-generated-template> igName = getMetadataValue(instanceTemplate.Properties.Metadata, MetadataKeyInstanceGroupName)
Defensive patterns
Strategy: validation
Validate before calling
tmpl, err := getInstanceTemplate(lastComponent(migMember.Version.InstanceTemplate))
if err == nil && getMetadataValue(tmpl.Properties.Metadata, MetadataKeyInstanceGroupName) == "" {
return fmt.Errorf("template %s lacks %s metadata; not a kops template", tmpl.Name, MetadataKeyInstanceGroupName)
} Type guard
func isKopsTemplate(t *compute.InstanceTemplate) bool {
return t != nil && t.Properties != nil &&
getMetadataValue(t.Properties.Metadata, MetadataKeyInstanceGroupName) != ""
} Try / catch
info, err := identifier.IdentifyNode(ctx, node)
if err != nil && strings.Contains(err.Error(), "ig name not set on instance template") {
// template not kops-generated: flag for kops update / manual fix
return fmt.Errorf("node %s uses non-kops template; run kops update cluster", node.Name)
} Prevention
- Never roll MIGs onto hand-built instance templates in kops clusters.
- Let kops generate templates via kops update cluster.
- Verify templates carry the instance-group-name metadata before use.
- Diff templates after console edits to ensure kops metadata survives.
When it happens
Trigger: migMember.Version -> instanceTemplate fetched successfully, but instanceTemplate.Properties.Metadata has no item whose key equals MetadataKeyInstanceGroupName — e.g. template created manually or by another tool.
Common situations: Custom/foreign instance templates attached to kops-managed MIGs; templates edited via console stripping kops metadata; kops versions mismatch where a newer/older template layout is present; manually rolled MIGs to hand-built templates.
Related errors
- cannot find owner for instance %s
- instance %s did not have Version set
- error fetching GCE managed instance group %q: %v
- error reading project from GCE: %v
- project metadata was empty
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/4be002ab4be8de03.
Report an issue: GitHub.