{"record":{"id":"a7c05fe81117b49d","repo":"kubernetes/kops","slug":"error-creating-instance-v-a7c05f","errorCode":null,"errorMessage":"Error creating instance: %v","messagePattern":"Error creating instance: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstacktasks/instance.go","lineNumber":381,"sourceCode":"\t\t\topt.UserData = bytes\n\t\t}\n\t\tif e.AvailabilityZone != nil {\n\t\t\topt.AvailabilityZone = fi.ValueOf(e.AvailabilityZone)\n\t\t}\n\t\tif opt, err = includeBootVolumeOptions(t, e, opt); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tkeyext := keypairs.CreateOptsExt{\n\t\t\tCreateOptsBuilder: opt,\n\t\t\tKeyName:           openstackKeyPairName(fi.ValueOf(e.SSHKey)),\n\t\t}\n\n\t\tschedulerHints := servers.SchedulerHintOpts{Group: *e.ServerGroup.ID}\n\n\t\tv, err := t.Cloud.CreateInstance(keyext, schedulerHints, fi.ValueOf(e.Port.ID))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error creating instance: %v\", err)\n\t\t}\n\t\te.ID = new(v.ID)\n\n\t\tif e.FloatingIP != nil {\n\t\t\terr = associateFloatingIP(t, e)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tklog.V(2).Infof(\"Creating a new Openstack instance, id=%s\", v.ID)\n\n\t\treturn nil\n\t}\n\tif changes.Port != nil {\n\t\t_, err := attachinterfaces.Create(context.TODO(), cloud.ComputeClient(), fi.ValueOf(e.ID), attachinterfaces.CreateOpts{\n\t\t\tPortID: fi.ValueOf(changes.Port.ID),\n\t\t}).Extract()","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstacktasks/instance.go#L363-L399","documentation":"This error wraps any failure returned by the Nova compute API when kOps' RenderOpenstack tries to boot a new server (Cloud.CreateInstance) with a keypair extension, scheduler hint (server group), and pre-created port. It is a pass-through wrapper: the underlying gophercloud/OpenStack error (auth, quota, flavor/image, network port, server-group policy, etc.) is appended verbatim. Because the create call is the core of instance provisioning, any non-2xx from POST /servers surfaces here.","triggerScenarios":"POST /v2.1/{project}/servers fails during `kops update cluster` on OpenStack: invalid or missing imageRef/flavorRef, quota exceeded (instances, cores, RAM), port ID not found or in wrong network, server group ID invalid, keypair name not found, AvailabilityZone invalid, boot-from-volume block-device mapping rejected, or Nova API outage/401.","commonSituations":"Wrong cloud/OS_* credentials or expired token; cluster config referencing an image or flavor name that no longer exists in the region; tenant quota exhausted after scaling; port created by a previous failed apply is stale/deleted; Octavia/Nova version mismatch rejecting the keypairs CreateOptsExt; region endpoint misconfigured.","solutions":["Read the wrapped inner error to identify the Nova failure (quota vs not-found vs auth) and fix that specific cause first","Verify the image and flavor names in the cluster spec still exist: `openstack image list`, `openstack flavor list`","Check project quotas: `openstack quota show` and raise instance/cores/RAM limits if exceeded","Validate the port and network exist: `openstack port show <port-id>`; rerun `kops update cluster` to recreate stale ports","Confirm OS_* environment variables / clouds.yaml credentials and the correct region with `openstack server list`"],"exampleFix":"// before (config referencing missing image, error surfaces at create)\nimage: ubuntu-18.04-x86_64\n// after (use an image that exists in the target region)\nimage: ubuntu-22.04-x86_64  # confirmed via `openstack image list`","handlingStrategy":"try-catch","validationCode":"// pre-flight: validate image, flavor, port, and quota before apply\nfunc validateInstanceInputs(imageName, flavorName, portID string) error {\n\tif _, err := images.Get(context.TODO(), imageClient, imageName).Extract(); err != nil {\n\t\treturn fmt.Errorf(\"image %q not found: %w\", imageName, err)\n\t}\n\tif _, err := flavors.Get(context.TODO(), computeClient, flavorName).Extract(); err != nil {\n\t\treturn fmt.Errorf(\"flavor %q not found: %w\", flavorName, err)\n\t}\n\tif _, err := ports.Get(context.TODO(), networkClient, portID).Extract(); err != nil {\n\t\treturn fmt.Errorf(\"port %q not found: %w\", portID, err)\n\t}\n\treturn nil\n}","typeGuard":"func isNotFoundErr(err error) bool {\n\tvar _, nf gophercloud.ErrDefault404\n\treturn errors.As(err, &nf) || strings.Contains(err.Error(), \"could not be found\")\n}","tryCatchPattern":"_, err := t.Cloud.CreateInstance(keyext, schedulerHints, fi.ValueOf(e.Port.ID))\nif err != nil {\n\tswitch {\n\tcase strings.Contains(err.Error(), \"Quota\"):\n\t\treturn fmt.Errorf(\"quota exceeded, request limit raise: %w\", err)\n\tcase isNotFoundErr(err):\n\t\treturn fmt.Errorf(\"referenced image/flavor/port missing: %w\", err)\n\tdefault:\n\t\treturn fmt.Errorf(\"Error creating instance: %w\", err)\n\t}\n}","preventionTips":["Verify image and flavor names exist in the target region before `kops update cluster`","Monitor project quotas (instances, cores, RAM) and raise limits ahead of scaling","Use immutable image IDs instead of names in the cluster spec when possible","Keep OS_* credentials/clouds.yaml valid and scoped to the correct region/project","Clean up stale ports/floating IPs after failed applies before retrying"],"tags":["openstack","nova","instance-provisioning","kops"],"backgroundTag":"openstack-server-create-failed","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"}