kubernetes/kops · error

error building cloud tags: %v

Error message

error building cloud tags: %v

What it means

buildElastigroup calls b.buildTags(ig) to compute the AWS cloud tags applied to the Elastigroup. This wrapper fires when tag construction fails, aborting creation of the Elastigroup task during `kops update cluster`.

Source

Thrown at pkg/model/awsmodel/spotinst.go:341

		return fmt.Errorf("error building public ip options: %v", err)
	}

	// Subnets.
	group.Subnets, err = b.buildSubnets(ig)
	if err != nil {
		return fmt.Errorf("error building subnets: %v", err)
	}

	// Capacity.
	group.MinSize, group.MaxSize = b.buildCapacity(ig)

	// Monitoring.
	group.Monitoring = ig.Spec.DetailedInstanceMonitoring

	// Tags.
	group.Tags, err = b.buildTags(ig)
	if err != nil {
		return fmt.Errorf("error building cloud tags: %v", err)
	}

	// Auto Scaler.
	group.AutoScalerOpts, err = b.buildAutoScalerOpts(b.ClusterName(), ig)
	if err != nil {
		return fmt.Errorf("error building auto scaler options: %v", err)
	}
	if group.AutoScalerOpts != nil { // remove unsupported options
		group.AutoScalerOpts.Taints = nil
	}

	// Instance Metadata Options
	group.InstanceMetadataOptions = b.buildInstanceMetadataOptions(ig)

	klog.V(4).Infof("Adding task: Elastigroup/%s", fi.ValueOf(group.Name))
	c.AddTask(group)

	return nil

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Read the wrapped inner error to find the offending tag key/value.
  2. Fix the tag entry in cluster.yaml / instance group spec (values must be plain strings).
  3. Run `kops replace -f cluster.yaml` then `kops update cluster` to apply the corrected spec.

Example fix

// before
cloudLabels:
  cost-center: 12345
// after
cloudLabels:
  cost-center: "12345"
Defensive patterns

Strategy: validation

Validate before calling

for k, v := range cluster.Spec.CloudLabels {
  if k == "" || v == "" {
    return fmt.Errorf("invalid cloud label %q=%q", k, v)
  }
}

Try / catch

if err := kopsUpdate(); err != nil {
  if strings.Contains(err.Error(), "error building cloud tags") {
    // fix the offending cloudLabels entry and retry
  }
}

Prevention

When it happens

Trigger: `kops update cluster` with Spotinst where tag building fails — usually an invalid tag spec (unparseable value) supplied via cluster/IG spec or Spotinst label-driven tag overrides.

Common situations: Hand-edited cluster.yaml with malformed tag entries; external tooling injecting non-string tag values; reserved-key conflicts introduced via cluster.spec.cloudLabels.

Related errors


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