kubernetes/kops · error

error listing DhcpOptions: %v

Error message

error listing DhcpOptions: %v

What it means

kOps wraps failures from the EC2 DescribeDhcpOptions API, which lists DHCP options sets carrying the cluster tags. Any API error is wrapped and aborts discovery of leftover DHCP options during cluster deletion.

Source

Thrown at pkg/resources/aws/aws.go:991

		resourceTracker.Blocks = blocks

		resourceTrackers = append(resourceTrackers, resourceTracker)
	}

	return resourceTrackers, nil
}

func DescribeDhcpOptions(cloud fi.Cloud) ([]ec2types.DhcpOptions, error) {
	ctx := context.TODO()
	c := cloud.(awsup.AWSCloud)

	klog.V(2).Infof("Listing EC2 DhcpOptions")
	request := &ec2.DescribeDhcpOptionsInput{
		Filters: BuildEC2Filters(cloud),
	}
	response, err := c.EC2().DescribeDhcpOptions(ctx, request)
	if err != nil {
		return nil, fmt.Errorf("error listing DhcpOptions: %v", err)
	}

	return response.DhcpOptions, nil
}

func DeleteInternetGateway(cloud fi.Cloud, r *resources.Resource) error {
	ctx := context.TODO()
	c := cloud.(awsup.AWSCloud)

	id := r.ID

	var igw *ec2types.InternetGateway
	{
		request := &ec2.DescribeInternetGatewaysInput{
			InternetGatewayIds: []string{id},
		}
		response, err := c.EC2().DescribeInternetGateways(ctx, request)
		if err != nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify credentials/region with `aws ec2 describe-dhcp-options --region <region>`
  2. If throttled, wait and rerun; the describe call is read-only and safe to retry
  3. Refresh AWS credentials (SSO/token expiry) before long-running deletes
  4. Check network access to the EC2 endpoint
Defensive patterns

Strategy: retry

Validate before calling

// preflight: credentials + region sanity
_, err := sts.New(sess).GetCallerIdentity(&sts.GetCallerIdentityInput{})
if err != nil { return fmt.Errorf("credentials: %w", err) }
_, err = ec2cli.DescribeDhcpOptions(&ec2.DescribeDhcpOptionsInput{MaxResults: aws.Int64(5)})
if err != nil { return fmt.Errorf("EC2 API unreachable: %w", err) }

Try / catch

var opts []ec2types.DhcpOptions
err := backoff.Retry(func() error {
	var e error
	opts, e = aws.DescribeDhcpOptions(cloud)
	if e != nil && strings.Contains(e.Error(), "Throttling") {
		return e // retryable
	}
	return backoff.Permanent(e)
}, backoff.WithMaxRetries(backoff.NewExponentialBackOff(), 5))

Prevention

When it happens

Trigger: EC2 DescribeDhcpOptions returns an error: invalid credentials, throttling, network outage, or an invalid filter combination produced by BuildEC2Filters.

Common situations: Expired session during long deletion runs; EC2 rate limiting under concurrent operations; region misconfiguration causing the call to hit the wrong endpoint.

Related errors


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