{"record":{"id":"0157220dba66441a","repo":"kubernetes/kops","slug":"instance-group-must-have-the-same-min-and-max-size","errorCode":null,"errorMessage":"instance group must have the same min and max size in Azure, but got %d and %d","messagePattern":"instance group must have the same min and max size in Azure, but got (.+?) and (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/azuremodel/vmscaleset.go","lineNumber":199,"sourceCode":"\treturn t, nil\n}\n\nfunc getCapacity(spec *kops.InstanceGroupSpec) (*int64, error) {\n\t// Follow the convention that all other CSPs have.\n\tminSize := int32(1)\n\tmaxSize := int32(1)\n\tif spec.MinSize != nil {\n\t\tminSize = fi.ValueOf(spec.MinSize)\n\t} else if spec.Role.HasNode() {\n\t\tminSize = 2\n\t}\n\tif spec.MaxSize != nil {\n\t\tmaxSize = *spec.MaxSize\n\t} else if spec.Role.HasNode() {\n\t\tmaxSize = 2\n\t}\n\tif minSize != maxSize {\n\t\treturn nil, fmt.Errorf(\"instance group must have the same min and max size in Azure, but got %d and %d\", minSize, maxSize)\n\t}\n\treturn new(int64(minSize)), nil\n}\n\nfunc getStorageProfile(spec *kops.InstanceGroupSpec) (*compute.VirtualMachineScaleSetStorageProfile, error) {\n\tvar volumeSize int32\n\tif spec.RootVolume != nil && spec.RootVolume.Size != nil {\n\t\tvolumeSize = *spec.RootVolume.Size\n\t} else {\n\t\tvar err error\n\t\tvolumeSize, err = defaults.DefaultInstanceGroupVolumeSize(spec.Role)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tvar storageAccountType compute.StorageAccountTypes\n\tif spec.RootVolume != nil && spec.RootVolume.Type != nil {","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/azuremodel/vmscaleset.go#L181-L217","documentation":"Azure VM ScaleSets provision a fixed-size group, so getCapacity requires the InstanceGroup's computed minSize and maxSize to be equal. When the effective min and max differ (after defaults are applied), it returns this error instead of building the scale set.","triggerScenarios":"Setting spec.minSize and spec.maxSize to different values on an Azure InstanceGroup, e.g. minSize: 1, maxSize: 5, then running `kops update cluster`.","commonSituations":"Pasting AWS-style autoscaling min/max configs into Azure clusters; relying on defaults where one size is set and the other falls back to a default (2 for node roles), causing a mismatch.","solutions":["Set spec.minSize and spec.maxSize to the same value in the InstanceGroup.","Remove both fields entirely so both fall back to the same defaults.","For elasticity on Azure, manage scaling via external autoscaler/cluster-autoscaler rather than differing min/max in the kops spec."],"exampleFix":"// before\nminSize: 1\nmaxSize: 5\n// after\nminSize: 3\nmaxSize: 3","handlingStrategy":"validation","validationCode":"if ig.Spec.MinSize != nil && ig.Spec.MaxSize != nil && *ig.Spec.MinSize != *ig.Spec.MaxSize {\n  return fmt.Errorf(\"azure instance group %q requires minSize == maxSize\", ig.Name)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set minSize and maxSIze to equal values (or omit both) for Azure instance groups.","Use cluster-autoscaler for elasticity instead of min/max ranges.","Add CI validation on cluster.yaml for Azure constraints."],"tags":["azure","autoscaling","instancegroup","vmss"],"backgroundTag":"min-max-size-mismatch","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"}