kubernetes/kops · error

creating DNS record %q in zone %q: %w

Error message

creating DNS record %q in zone %q: %w

What it means

In RenderScw for the DNS record task, the Scaleway Domain API UpdateDNSZoneRecords call failed while applying an 'add' change — creating a new DNS record with the expected name/type/TTL/data in the given DNS zone. The wrapped error carries the SDK cause (invalid zone, duplicate record, permissions).

Source

Thrown at upup/pkg/fi/cloudup/scalewaytasks/dns_record.go:157

	recordCreated, err := t.Cloud.DomainService().UpdateDNSZoneRecords(&domain.UpdateDNSZoneRecordsRequest{
		DNSZone: fi.ValueOf(expected.DNSZone),
		Changes: []*domain.RecordChange{
			{
				Add: &domain.RecordChangeAdd{
					Records: []*domain.Record{
						{
							Data: fi.ValueOf(expected.Data),
							Name: fi.ValueOf(expected.Name),
							TTL:  fi.ValueOf(expected.TTL),
							Type: domain.RecordType(fi.ValueOf(expected.Type)),
						},
					},
				},
			},
		},
	})
	if err != nil {
		return fmt.Errorf("creating DNS record %q in zone %q: %w", fi.ValueOf(expected.Name), fi.ValueOf(expected.DNSZone), err)
	}

	expected.ID = &recordCreated.Records[0].ID

	return nil
}

type terraformDNSRecord struct {
	Name      *string              `cty:"name"`
	Data      *string              `cty:"data"`
	DNSZone   *string              `cty:"dns_zone"`
	Type      *string              `cty:"type"`
	TTL       *int32               `cty:"ttl"`
	Lifecycle *terraform.Lifecycle `cty:"lifecycle"`
}

func (_ *DNSRecord) RenderTerraform(t *terraform.TerraformTarget, actual, expected, changes *DNSRecord) error {
	tf := terraformDNSRecord{

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Confirm the zone exists in Scaleway (scw domain zone get <zone>) or move DNS hosting to Scaleway
  2. Validate record Data/Type/TTL values in the cluster spec
  3. Grant domain write permission to kOps credentials
  4. Retry if transient; check Scaleway status page for incidents

Example fix

// before
kubernetesCluster.example.com  # zone that is not hosted on Scaleway
// after
example.com                    # zone hosted/validated in Scaleway
Defensive patterns

Strategy: try-catch

Validate before calling

// confirm zone exists and is writable before adding records
zoneResp, err := cloud.DomainService().GetZone(&domain.GetZoneRequest{DNSZone: fi.ValueOf(expected.DNSZone)})
if err != nil {
	return fmt.Errorf("zone %q unavailable for records: %w", fi.ValueOf(expected.DNSZone), err)
}
_ = zoneResp

Type guard

func isValidRecordData(rtype string, data string) bool {
	switch rtype {
	case "A":
		ip := net.ParseIP(data)
		return ip != nil && ip.To4() != nil
	case "AAAA":
		ip := net.ParseIP(data)
		return ip != nil && ip.To4() == nil
	case "CNAME":
		return strings.HasSuffix(data, ".")
	}
	return data != ""
}

Try / catch

if err != nil {
	var rerr *scw.ResponseError
	if errors.As(err, &rerr) && (rerr.StatusCode == 429 || rerr.StatusCode >= 500) {
		// retry create with backoff
	}
	return fmt.Errorf("creating DNS record %q in zone %q: %w", name, zone, err)
}

Prevention

When it happens

Trigger: UpdateDNSZoneRecords with an Add change fails — commonly because the DNS zone does not exist or is not served by Scaleway, the record payload is invalid (bad data/type/TTL), or credentials lack write permission.

Common situations: Zone not configured in Scaleway (domain hosted elsewhere), invalid record data in the cluster spec, IAM policy missing domain write, or transient Scaleway API outage.

Related errors


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