kubernetes/kops · error

error listing DHCPOptions: %v

Error message

error listing DHCPOptions: %v

What it means

Wraps AWS SDK errors from EC2 DescribeDhcpOptions during Find for the DHCPOptions task. kOps looks up existing DHCP options sets by name tag/filters; any API failure other than an empty result becomes this wrapped error.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/dhcp_options.go:68

var _ fi.CompareWithID = (*DHCPOptions)(nil)

func (e *DHCPOptions) CompareWithID() *string {
	return e.ID
}

func (e *DHCPOptions) Find(c *fi.CloudupContext) (*DHCPOptions, error) {
	cloud := awsup.GetCloud(c)

	request := &ec2.DescribeDhcpOptionsInput{}
	if e.ID != nil {
		request.DhcpOptionsIds = []string{aws.ToString(e.ID)}
	} else {
		request.Filters = cloud.BuildFilters(e.Name)
	}

	response, err := cloud.EC2().DescribeDhcpOptions(c.Context(), request)
	if err != nil {
		return nil, fmt.Errorf("error listing DHCPOptions: %v", err)
	}

	if response == nil || len(response.DhcpOptions) == 0 {
		return nil, nil
	}

	if len(response.DhcpOptions) != 1 {
		return nil, fmt.Errorf("found multiple DhcpOptions with name: %s", *e.Name)
	}
	klog.V(2).Info("found existing DhcpOptions")
	o := response.DhcpOptions[0]
	actual := &DHCPOptions{
		ID:   o.DhcpOptionsId,
		Name: findNameTag(o.Tags),
		Tags: intersectTags(o.Tags, e.Tags),
	}

	for _, s := range o.DhcpConfigurations {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the wrapped error in the message for the AWS error code
  2. Grant ec2:DescribeDhcpOptions to the kOps IAM role
  3. Verify AWS credentials and target region
  4. Retry on throttling with backoff
Defensive patterns

Strategy: try-catch

Validate before calling

aws ec2 describe-dhcp-options --filters Name=tag:Name,Values=$CLUSTER_NAME 2>&1 | head -1 # verifies perms + reachability before apply

Type guard

function isCredErr(err) { return err && ['InvalidClientTokenId','AuthFailure'].includes(err.code); }

Try / catch

try {
  dhcp = findDHCPOptions(ctx, task);
} catch (err) {
  if (isCredErr(err)) fixCredentialsAndRetry();
  else if (awsup.AWSErrorCode(err) === 'Throttling') backoffAndRetry();
  else throw err;
}

Prevention

When it happens

Trigger: cloud.EC2().DescribeDhcpOptions fails: missing ec2:DescribeDhcpOptions IAM permission, invalid filter values, throttling, or connectivity/credential problems.

Common situations: Restricted IAM policies on kops controllers; stale credentials (InvalidClientTokenId); AWS throttling during large applies; region misconfiguration.

Related errors


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