kubernetes/kops · error

error initializing digitalocean cloud: %s

Error message

error initializing digitalocean cloud: %s

What it means

Thrown in BuildCloud when do.NewDOCloud fails for the region taken from the first subnet's zone. Initialization usually fails because the DigitalOcean API token is missing from the environment (the cloud implementation reads credentials at construction), or the region string is invalid/empty.

Source

Thrown at upup/pkg/fi/cloudup/utils.go:115

				if subnet.Zone != "" {
					zoneNames = append(zoneNames, subnet.Zone)
				}
			}
			err = awsup.ValidateZones(zoneNames, awsCloud)
			if err != nil {
				return nil, err
			}
			cloud = awsCloud
		}
	case kops.CloudProviderDO:
		{
			// for development purposes we're going to assume
			// single region setups for DO. Reconsider this logic
			// when setting up multi-region kubernetes clusters on DO
			region := cluster.Spec.Networking.Subnets[0].Zone
			doCloud, err := do.NewDOCloud(region)
			if err != nil {
				return nil, fmt.Errorf("error initializing digitalocean cloud: %s", err)
			}

			cloud = doCloud
		}

	case kops.CloudProviderHetzner:
		{
			region, err := hetzner.FindRegion(cluster)
			if err != nil {
				return nil, err
			}

			hetznerCloud, err := hetzner.NewHetznerCloud(region)
			if err != nil {
				return nil, fmt.Errorf("error initializing hetzner cloud: %s", err)
			}

			cloud = hetznerCloud

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Provide a valid DigitalOcean API token via the environment variable the DO cloud implementation expects (e.g. DIGITALOCEAN_ACCESS_TOKEN)
  2. Check that the first subnet's zone is a real DO region slug (e.g. nyc3) and not empty
  3. Retry after fixing credentials; no cloud resources were created yet
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/utils.go:115 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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