kubernetes/kops · error
Error creating instance: %v
Error message
Error creating instance: %v
What it means
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.
Source
Thrown at upup/pkg/fi/cloudup/openstacktasks/instance.go:381
opt.UserData = bytes
}
if e.AvailabilityZone != nil {
opt.AvailabilityZone = fi.ValueOf(e.AvailabilityZone)
}
if opt, err = includeBootVolumeOptions(t, e, opt); err != nil {
return err
}
keyext := keypairs.CreateOptsExt{
CreateOptsBuilder: opt,
KeyName: openstackKeyPairName(fi.ValueOf(e.SSHKey)),
}
schedulerHints := servers.SchedulerHintOpts{Group: *e.ServerGroup.ID}
v, err := t.Cloud.CreateInstance(keyext, schedulerHints, fi.ValueOf(e.Port.ID))
if err != nil {
return fmt.Errorf("Error creating instance: %v", err)
}
e.ID = new(v.ID)
if e.FloatingIP != nil {
err = associateFloatingIP(t, e)
if err != nil {
return err
}
}
klog.V(2).Infof("Creating a new Openstack instance, id=%s", v.ID)
return nil
}
if changes.Port != nil {
_, err := attachinterfaces.Create(context.TODO(), cloud.ComputeClient(), fi.ValueOf(e.ID), attachinterfaces.CreateOpts{
PortID: fi.ValueOf(changes.Port.ID),
}).Extract()View on GitHub (pinned to 4c8573c808)
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`
Example fix
// before (config referencing missing image, error surfaces at create) image: ubuntu-18.04-x86_64 // after (use an image that exists in the target region) image: ubuntu-22.04-x86_64 # confirmed via `openstack image list`
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-flight: validate image, flavor, port, and quota before apply
func validateInstanceInputs(imageName, flavorName, portID string) error {
if _, err := images.Get(context.TODO(), imageClient, imageName).Extract(); err != nil {
return fmt.Errorf("image %q not found: %w", imageName, err)
}
if _, err := flavors.Get(context.TODO(), computeClient, flavorName).Extract(); err != nil {
return fmt.Errorf("flavor %q not found: %w", flavorName, err)
}
if _, err := ports.Get(context.TODO(), networkClient, portID).Extract(); err != nil {
return fmt.Errorf("port %q not found: %w", portID, err)
}
return nil
} Type guard
func isNotFoundErr(err error) bool {
var _, nf gophercloud.ErrDefault404
return errors.As(err, &nf) || strings.Contains(err.Error(), "could not be found")
} Try / catch
_, err := t.Cloud.CreateInstance(keyext, schedulerHints, fi.ValueOf(e.Port.ID))
if err != nil {
switch {
case strings.Contains(err.Error(), "Quota"):
return fmt.Errorf("quota exceeded, request limit raise: %w", err)
case isNotFoundErr(err):
return fmt.Errorf("referenced image/flavor/port missing: %w", err)
default:
return fmt.Errorf("Error creating instance: %w", err)
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- error building nova client: %v
- no decernable storage availability zone could be mapped to c
- error building nova client: %w
- could not delete instance %q: %v
- could not list server groups %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/a7c05fe81117b49d.
Report an issue: GitHub.