{"record":{"id":"27f1145f92931132","repo":"kubernetes/kops","slug":"error-building-dns-provider-v-27f114","errorCode":null,"errorMessage":"error building DNS provider: %v","messagePattern":"error building DNS provider: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/do/cloud.go","lineNumber":193,"sourceCode":"func (c *doCloudImplementation) DetachInstance(i *cloudinstances.CloudInstance) error {\n\tklog.V(8).Info(\"digitalocean cloud provider DetachInstance not implemented yet\")\n\treturn fmt.Errorf(\"digital ocean cloud provider does not support surging\")\n}\n\n// ProviderID returns the kops api identifier for DigitalOcean cloud provider\nfunc (c *doCloudImplementation) ProviderID() kops.CloudProviderID {\n\treturn kops.CloudProviderDO\n}\n\n// Region returns the DO region we will target\nfunc (c *doCloudImplementation) Region() string {\n\treturn c.region\n}\n\nfunc (c *doCloudImplementation) DNS() (dnsprovider.Interface, error) {\n\tprovider, err := dnsprovider.GetDnsProvider(dns.ProviderName, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error building DNS provider: %v\", err)\n\t}\n\treturn provider, nil\n}\n\n// KeysService returns an implementation of godo.KeysService\nfunc (c *doCloudImplementation) KeysService() godo.KeysService {\n\treturn c.Client.Keys\n}\n\n// Volumes returns an implementation of godo.StorageService\nfunc (c *doCloudImplementation) VolumeService() godo.StorageService {\n\treturn c.Client.Storage\n}\n\n// VolumeActions returns an implementation of godo.StorageActionsService\nfunc (c *doCloudImplementation) VolumeActionService() godo.StorageActionsService {\n\treturn c.Client.StorageActions\n}","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/do/cloud.go#L175-L211","documentation":"DNS() lazily constructs the DNS provider (the digitalocean dnsprovider plugin, per dns.ProviderName) via dnsprovider.GetDnsProvider with a nil config. The error is whatever the DNS provider registry/constructor returned, wrapped with context. Since nil config is passed, the provider must be able to self-configure (typically from the DO_ACCESS_TOKEN env var).","triggerScenarios":"dnsprovider.GetDnsProvider fails because the 'digitalocean' provider is not registered (plugin/dependency missing), or its constructor fails — usually because the DO API token environment variable is unset/invalid, or the provider config cannot be read.","commonSituations":"Missing DO_ACCESS_TOKEN when running kOps against DO; building a trimmed kOps binary without the DO DNS provider registered; typos in DNS configuration for the cluster.","solutions":["Export DO_ACCESS_TOKEN with a valid DigitalOcean API token before running kOps.","Verify the cluster spec uses a DNS setup compatible with the DO provider and that the dns-provider plugin is compiled in.","Run with klog verbosity to see the underlying wrapped error from GetDnsProvider for the exact cause.","If using external DNS instead, ensure the cluster's DNS configuration doesn't route through this provider."],"exampleFix":"// before\nprovider, err := dnsprovider.GetDnsProvider(dns.ProviderName, nil)\n// after (caller-side environment guard)\nif os.Getenv(\"DO_ACCESS_TOKEN\") == \"\" {\n    return nil, fmt.Errorf(\"DO_ACCESS_TOKEN must be set to build the DigitalOcean DNS provider\")\n}\nprovider, err := dnsprovider.GetDnsProvider(dns.ProviderName, nil)","handlingStrategy":"validation","validationCode":"if os.Getenv(\"DO_ACCESS_TOKEN\") == \"\" {\n    return fmt.Errorf(\"DO_ACCESS_TOKEN must be set before building the DO DNS provider\")\n}\n_, _, err := client.Domains.List(context.TODO(), nil)\nif err != nil { return fmt.Errorf(\"DO token invalid for DNS: %w\", err) }","typeGuard":null,"tryCatchPattern":"provider, err := cloud.DNS()\nif err != nil {\n    return fmt.Errorf(\"check DO_ACCESS_TOKEN and dns provider registration: %w\", err)\n}","preventionTips":["Always export DO_ACCESS_TOKEN in the environment running kOps.","Verify the DO DNS provider plugin is compiled into your kOps build.","Test the token with a cheap DO API call (list domains) before cluster operations."],"tags":["digitalocean","dns","configuration","provider-init"],"backgroundTag":"missing-api-token","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}