kubernetes/kops · error

%s is not a valid metadata search order option. Supported op

Error message

%s is not a valid metadata search order option. Supported options are %s and %s

What it means

getMetadata iterates a configured search order of metadata sources. If an entry is neither ConfigDriveID nor MetadataID, it records this error listing the two supported options (upup/pkg/fi/cloudup/openstack/openstackmetadata/metadata.go:189). It is purely a configuration-validation error.

Source

Thrown at upup/pkg/fi/cloudup/openstack/openstackmetadata/metadata.go:189

// Depending on the searchOrder it will return data from the first source which successfully returns.
// If all the sources in searchOrder are erroneous it will propagate the last error to its caller.
func (mds MetadataService) getMetadata() (*InstanceMetadata, error) {
	// Note(ederst): I used and modified code for getting the config drive metadata to work from here:
	//   * https://github.com/kubernetes/cloud-provider-openstack/blob/27b6fc483451b6df2112a6a4a40a34ffc9093635/pkg/util/metadata/metadata.go

	var meta *InstanceMetadata
	var err error

	ids := strings.Split(mds.searchOrder, ",")
	for _, id := range ids {
		id = strings.TrimSpace(id)
		switch id {
		case ConfigDriveID:
			meta, err = mds.getFromConfigDrive()
		case MetadataID:
			meta, err = mds.getFromMetadataService()
		default:
			err = fmt.Errorf("%s is not a valid metadata search order option. Supported options are %s and %s", id, ConfigDriveID, MetadataID)
		}

		if err == nil {
			break
		}
	}

	return meta, err
}

// getDefaultMounter returns a mount and executor interface to use for getting metadata from a config drive
func getDefaultMounter() *mount.SafeFormatAndMount {
	mounter := mount.New("")
	exec := utilexec.New()
	return &mount.SafeFormatAndMount{
		Interface: mounter,
		Exec:      exec,
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set the search order to exactly "configDrive" and/or "metadataService" (match the ConfigDriveID/MetadataID constants).
  2. Check kOps docs for the current valid values of the OpenStack metadata search order option for your kOps version.
  3. Validate the cluster spec (kops replace/update output) before applying to catch the typo early.
  4. If migrating from an older version, update any deprecated option names to the current constants.

Example fix

// before
metadataSearchOrder: "metadata, configdrive"
// after
metadataSearchOrder: "configDrive, metadataService"
Defensive patterns

Strategy: validation

Validate before calling

// Validate the configured search order against the supported options
var valid = map[string]bool{"configDrive": true, "metadataService": true}
for _, id := range searchOrder {
    if !valid[id] {
        return fmt.Errorf("%q is invalid; supported options are configDrive and metadataService", id)
    }
}

Try / catch

meta, err := mds.getMetadata()
if err != nil {
    if strings.Contains(err.Error(), "not a valid metadata search order option") {
        // fix configuration to only use 'configDrive' and 'metadataService', then retry
    }
    return nil, err
}

Prevention

When it happens

Trigger: The metadata search-order configuration contains a string other than "configDrive" or "metadataService" — a typo (e.g. "metadata"), wrong casing, or a stale option name in cluster spec / environment config.

Common situations: Hand-edited cluster spec setting an invalid --openstack-metadata-search-order value; documentation drift after the option names changed between kOps versions; YAML typos in the cluster configuration.

Related errors


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