{"record":{"id":"e5773821034ab13d","repo":"kubernetes/kops","slug":"error-creating-servergroup-v","errorCode":null,"errorMessage":"error creating ServerGroup: %v","messagePattern":"error creating ServerGroup: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstacktasks/servergroup.go","lineNumber":154,"sourceCode":"\t\tif changes.Name != nil {\n\t\t\treturn fi.CannotChangeField(\"Name\")\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (_ *ServerGroup) RenderOpenstack(t *openstack.OpenstackAPITarget, a, e, changes *ServerGroup) error {\n\tif a == nil {\n\t\tklog.V(2).Infof(\"Creating ServerGroup with Name:%q\", fi.ValueOf(e.Name))\n\n\t\topt := servergroups.CreateOpts{\n\t\t\tName:     fi.ValueOf(e.Name),\n\t\t\tPolicies: e.Policies,\n\t\t}\n\n\t\tg, err := t.Cloud.CreateServerGroup(opt)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error creating ServerGroup: %v\", err)\n\t\t}\n\t\te.ID = new(g.ID)\n\t\treturn nil\n\t} else if changes.IGMap != nil {\n\t\tfor igName, maxSize := range changes.IGMap {\n\t\t\tactualIG := a.IGMap[igName]\n\t\t\tif fi.ValueOf(actualIG) > fi.ValueOf(maxSize) {\n\t\t\t\tcurrentLastIndex := fi.ValueOf(actualIG)\n\n\t\t\t\tfor currentLastIndex > fi.ValueOf(maxSize) {\n\t\t\t\t\tiName := strings.ToLower(fmt.Sprintf(\"%s-%d.%s\", igName, currentLastIndex, fi.ValueOf(a.ClusterName)))\n\t\t\t\t\tinstanceName := strings.ReplaceAll(iName, \".\", \"-\")\n\t\t\t\t\topts := servers.ListOpts{\n\t\t\t\t\t\tName: fmt.Sprintf(\"^%s\", igName),\n\t\t\t\t\t}\n\t\t\t\t\tallInstances, err := t.Cloud.ListInstances(opts)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"error fetching instance list: %v\", err)","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstacktasks/servergroup.go#L136-L172","documentation":"This error is returned by RenderOpenstack when the OpenStack API call to create a new Server Group (t.Cloud.CreateServerGroup) fails. Server Groups in OpenStack control anti-affinity/affinity scheduling policies for instances, and kOps creates one per instance group policy set. The wrapped %v carries the underlying gophercloud error (auth failure, quota, policy name invalid, etc.).","triggerScenarios":"RenderOpenstack executing the create branch of the ServerGroup task: t.Cloud.CreateServerGroup(opt) returns a non-nil error. Causes include expired/missing OpenStack credentials, nonexistent or disabled Nova service, invalid policy names (e.g. not 'affinity'/'anti-affinity'/'soft-anti-affinity'), or project quota exceeded for server groups.","commonSituations":"Cluster creation/upgrade on OpenStack with wrong OS_* environment variables or an expired application credential; a user specifying an unsupported policy in the cluster spec; the cloud having no server-group quota left (default 10 per project); Nova API endpoint unreachable or version mismatch.","solutions":["Run 'openstack server group create --policy anti-affinity test' with the same credentials to see the raw Nova error and confirm auth/quota issues.","Verify OpenStack credentials (OS_AUTH_URL, OS_USERNAME/OS_APPLICATION_CREDENTIAL_ID, OS_PROJECT_NAME, region) used by the kOps cloud provider.","Check that Policies in the ServerGroup task spec only contain values supported by your Nova version (affinity, anti-affinity, soft-affinity, soft-anti-affinity).","Check/raise the 'server groups' quota for the project in OpenStack, or delete unused server groups.","Confirm the compute (Nova) service and server group API are enabled in the target cloud/region."],"exampleFix":"// before: policies guessed / typo'd\nPolicies: []string{\"anti affinity\"}\n// after: only valid Nova policies\nPolicies: []string{\"anti-affinity\"}","handlingStrategy":"validation","validationCode":"// Pre-validate credentials and policy before creating a cluster\ntest -n \"$OS_AUTH_URL\" && test -n \"$OS_APPLICATION_CREDENTIAL_ID\" || echo \"OpenStack creds missing\"\nopenstack server group list 2>/dev/null || echo \"Nova server-group API not reachable\"\ncase \"${POLICY:-anti-affinity}\" in\n  affinity|anti-affinity|soft-affinity|soft-anti-affinity) ;;\n  *) echo \"unsupported Nova policy: $POLICY\" && exit 1 ;;\nesac","typeGuard":null,"tryCatchPattern":"// in Go, if driving fi yourself\ng, err := cloud.CreateServerGroup(opt)\nif err != nil {\n    klog.Warningf(\"server group create failed (%v); check quota/auth then retry\", err)\n    return retryable(err)\n}","preventionTips":["Validate OS_* auth env vars or clouds.yaml before kops create/update.","Keep Policies limited to valid Nova values (affinity/anti-affinity/soft-*).","Monitor and pre-raise the project 'server groups' quota before large cluster builds.","Smoke-test with 'openstack server group create --policy anti-affinity tmp-test' in CI before running kops."],"tags":["openstack","nova","server-group","cloud-api"],"backgroundTag":"openstack-server-group-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"}