kubernetes/kops · error

region is required

Error message

region is required

What it means

NewCloud for the Akamai (Linode) provider requires a cloud region string to construct the Cloud object. An empty region means the cloud abstraction cannot be scoped, so construction is rejected immediately with 'region is required'.

Source

Thrown at upup/pkg/fi/cloudup/linode/cloud.go:85

// LinodeCloud exposes Akamai (Linode) cloud APIs used by kOps.
type LinodeCloud interface {
	fi.Cloud
	Client() LinodeClient
}

type Cloud struct {
	region string
	client LinodeClient
}

var _ LinodeCloud = &Cloud{}

var invalidLinodeLabelChars = regexp.MustCompile(`[^A-Za-z0-9_-]+`)

func NewCloud(region string) (LinodeCloud, error) {
	if region == "" {
		return nil, fmt.Errorf("region is required")
	}

	accessToken := os.Getenv("LINODE_TOKEN")
	if accessToken == "" {
		return nil, fmt.Errorf("%s is required", "LINODE_TOKEN")
	}

	client, err := linodego.NewClient(nil)
	if err != nil {
		return nil, fmt.Errorf("failed to create Linode client: %w", err)
	}
	client.SetUserAgent("kops/" + kopsv.Version)
	client.SetToken(accessToken)

	return &Cloud{
		region: region,
		client: &client,
	}, nil

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set `spec.region` (top-level kops cluster region) to a valid Linode region, e.g. us-east or eu-west, in the cluster manifest.
  2. Re-run `kops create/replace -f cluster.yaml && kops update cluster`.
  3. If calling NewCloud programmatically, pass the region explicitly instead of relying on defaults.

Example fix

// before (cluster.yaml)
metadata:
  name: cluster.example.com
// after
metadata:
  name: cluster.example.com
spec:
  region: us-east
Defensive patterns

Strategy: validation

Validate before calling

if cluster.Spec.Region == "" {
	return fmt.Errorf("cluster.spec.region must be set for the Linode provider (e.g. us-east)")
}

Type guard

func hasRegion(c *kops.Cluster) bool { return c != nil && c.Spec.Region != "" }

Try / catch

cloud, err := BuildCloud(...)
if err != nil {
	if strings.Contains(err.Error(), "region is required") {
		// prompt user / fail fast with guidance to set spec.region
	}
}

Prevention

When it happens

Trigger: BuildCloud calls NewCloud("") — i.e. the cluster spec has no region set for the Linode provider, or the region was not propagated from the cluster configuration.

Common situations: Creating/updating a Linode-backed cluster whose cluster.yaml lacks the `region` field, or programmatic callers building the cloud before the cluster spec is fully populated.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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