kubernetes/kops · error
unable to find region
Error message
unable to find region
What it means
Thrown by NewOpenstackVerifier when the OS_REGION_NAME environment variable is unset or empty. The verifier needs the region to build region-scoped Nova (compute V2) endpoints; without it, client construction cannot proceed, so it fails fast before contacting OpenStack.
Source
Thrown at upup/pkg/fi/cloudup/openstack/verifier.go:61
type OpenStackVerifierOptions struct {
}
type openstackVerifier struct {
novaClient *gophercloud.ServiceClient
kubeClient *kubernetes.Clientset
}
var _ bootstrap.Verifier = (*openstackVerifier)(nil)
func NewOpenstackVerifier(opt *OpenStackVerifierOptions) (bootstrap.Verifier, error) {
env, err := gos.AuthOptionsFromEnv()
if err != nil {
return nil, err
}
region := os.Getenv("OS_REGION_NAME")
if region == "" {
return nil, fmt.Errorf("unable to find region")
}
provider, err := gos.NewClient(env.IdentityEndpoint)
if err != nil {
return nil, err
}
ua := gophercloud.UserAgent{}
ua.Prepend("kops/kopscontrollerverifier")
provider.UserAgent = ua
klog.V(4).Infof("Using user-agent %s", ua.Join())
// node-controller should be able to renew it tokens against OpenStack API
env.AllowReauth = true
err = gos.Authenticate(context.TODO(), provider, env)
if err != nil {
return nil, err
}View on GitHub (pinned to 4c8573c808)
Solutions
- Export the region before running: `export OS_REGION_NAME=<region>` (find it via `openstack region list`).
- Re-source the correct OpenStack RC file that includes OS_REGION_NAME.
- If using CI/scripts, add OS_REGION_NAME alongside the other OS_* variables.
Example fix
// before ./kops-verifier ... # fails: unable to find region // after export OS_REGION_NAME=$(openstack region list -f value -c Region | head -1) ./kops-verifier ...
Defensive patterns
Strategy: validation
Validate before calling
region := os.Getenv("OS_REGION_NAME")
if region == "" {
return errors.New("OS_REGION_NAME must be set; source your openrc file")
} Try / catch
verifier, err := NewOpenstackVerifier(ctx, buildEnv, cluster, kubeClientConfig)
if err != nil {
log.Fatalf("verifier init: %v (did you source openrc?)", err)
} Prevention
- Always source the openrc file before running the verifier
- Add a startup check for required OS_* env vars
- In CI, include OS_REGION_NAME in the secrets/env injection
When it happens
Trigger: Running the kops verifier binary (via main) after openstack credential env loading, where OS_REGION_NAME is missing — not set in the shell, absent from the sourced RC file, or not injected in CI.
Common situations: Forgetting to source the OpenStack RC (openrc) file that sets OS_REGION_NAME; clouds.yaml-based auth that doesn't export a region; CI environments with partial OS_* credential injection; region renamed by the cloud operator.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- unable to find region
- error finding openstack region: %v
- region not provided in OS_REGION_NAME or openstack config se
- failed to find cluster dns zone
- exactly one 'admin' SSH public key can be specified when run
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/a96f836b238406e1.
Report an issue: GitHub.