kubernetes/kops · error

error updating AutoscalingGroup: %v

Error message

error updating AutoscalingGroup: %v

What it means

kops wraps the AWS AutoScaling UpdateAutoScalingGroup API error when applying changes to an existing ASG during cluster reconciliation in RenderAWS. The underlying AWS error (message included via %v) indicates why the update call was rejected, e.g. invalid configuration or a resource that no longer exists.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go:661

		if changes.InstanceProtection != nil {
			request.NewInstancesProtectedFromScaleIn = e.InstanceProtection
			changes.InstanceProtection = nil
		}

		if changes.CapacityRebalance != nil {
			request.CapacityRebalance = e.CapacityRebalance
			changes.CapacityRebalance = nil
		}

		empty := &AutoscalingGroup{}
		if !reflect.DeepEqual(empty, changes) {
			klog.Warningf("cannot apply changes to AutoScalingGroup: %v", changes)
		}

		klog.V(2).Infof("Updating autoscaling group %s", fi.ValueOf(e.Name))

		if _, err := t.Cloud.Autoscaling().UpdateAutoScalingGroup(ctx, request); err != nil {
			return fmt.Errorf("error updating AutoscalingGroup: %v", err)
		}

		if deleteTagsRequest != nil && len(deleteTagsRequest.Tags) > 0 {
			if _, err := t.Cloud.Autoscaling().DeleteTags(ctx, deleteTagsRequest); err != nil {
				return fmt.Errorf("error deleting old AutoscalingGroup tags: %v", err)
			}
		}
		if updateTagsRequest != nil {
			if _, err := t.Cloud.Autoscaling().CreateOrUpdateTags(ctx, updateTagsRequest); err != nil {
				return fmt.Errorf("error updating AutoscalingGroup tags: %v", err)
			}
		}

		if detachLBRequest != nil {
			if _, err := t.Cloud.Autoscaling().DetachLoadBalancers(ctx, detachLBRequest); err != nil {
				return fmt.Errorf("error detatching LoadBalancers: %v", err)
			}
		}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Read the wrapped AWS error message: if the ASG is not found, re-run `kops update cluster` to recreate it or delete the stale instance group.
  2. Fix MinSize/MaxSize/desired capacity in the InstanceGroup spec so maxSize >= minSize and re-apply.
  3. Verify the launch template/mixed instances policy referenced still exists and its version is valid.
  4. Check IAM permissions of the credentials kops uses (autoscaling:UpdateAutoScalingGroup) and retry after a short delay if throttled.

Example fix

// before: maxSize reduced below minSize in ig spec
spec:
  minSize: 3
  maxSize: 2
// after
spec:
  minSize: 3
  maxSize: 5
Defensive patterns

Strategy: retry

Validate before calling

// before apply: sanity-check ASG spec
if ig.Spec.MaxSize < ig.Spec.MinSize {
  return fmt.Errorf("instanceGroup %s: maxSize (%d) < minSize (%d)", ig.Name, ig.Spec.MaxSize, ig.Spec.MinSize)
}
// confirm ASG exists
_, err := svc.DescribeAutoScalingGroups(&autoscaling.DescribeAutoScalingGroupsInput{
  AutoScalingGroupNames: []string{asgName},
})

Try / catch

if err := apply(); err != nil {
  var ae smithy.APIError
  if errors.As(err, &ae) && isThrottlingCode(ae.ErrorCode()) {
    backoffAndRetry()
  } else {
    log.Fatalf("error updating AutoscalingGroup: %v", err)
  }
}

Prevention

When it happens

Trigger: Calling fi apply/`kops update cluster --yes` while an AutoScalingGroup task renders an update and the AWS SDK call UpdateAutoScalingGroup fails: ASG name not found (deleted out-of-band), invalid MinSize/MaxSize combination, invalid launch template version, or throttling/IAM permission failure.

Common situations: ASG was manually deleted in the AWS console while kops still tracks it; instance group spec produces maxSize < minSize; launch template version referenced was deleted; IAM role lacks autoscaling:UpdateAutoScalingGroup; AWS API throttling during large cluster updates.

Related errors


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