{"record":{"id":"2117ece67f326a29","repo":"kubernetes/kubernetes","slug":"max-endpoints-per-slice-must-not-be-more-than-d","errorCode":null,"errorMessage":"max-endpoints-per-slice must not be more than %d, but got %d","messagePattern":"max-endpoints-per-slice must not be more than (.+?), but got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kube-controller-manager/app/options/endpointslicecontroller.go","lineNumber":80,"sourceCode":"\n// Validate checks validation of EndpointSliceControllerOptions.\nfunc (o *EndpointSliceControllerOptions) Validate() []error {\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\terrs := []error{}\n\n\tif o.ConcurrentServiceEndpointSyncs < minConcurrentServiceEndpointSyncs {\n\t\terrs = append(errs, fmt.Errorf(\"concurrent-service-endpoint-syncs must not be less than %d, but got %d\", minConcurrentServiceEndpointSyncs, o.ConcurrentServiceEndpointSyncs))\n\t} else if o.ConcurrentServiceEndpointSyncs > maxConcurrentServiceEndpointSyncs {\n\t\terrs = append(errs, fmt.Errorf(\"concurrent-service-endpoint-syncs must not be more than %d, but got %d\", maxConcurrentServiceEndpointSyncs, o.ConcurrentServiceEndpointSyncs))\n\t}\n\n\tif o.MaxEndpointsPerSlice < minMaxEndpointsPerSlice {\n\t\terrs = append(errs, fmt.Errorf(\"max-endpoints-per-slice must not be less than %d, but got %d\", minMaxEndpointsPerSlice, o.MaxEndpointsPerSlice))\n\t} else if o.MaxEndpointsPerSlice > maxMaxEndpointsPerSlice {\n\t\terrs = append(errs, fmt.Errorf(\"max-endpoints-per-slice must not be more than %d, but got %d\", maxMaxEndpointsPerSlice, o.MaxEndpointsPerSlice))\n\t}\n\n\treturn errs\n}\n","sourceCodeStart":62,"sourceCodeEnd":85,"githubUrl":"https://github.com/kubernetes/kubernetes/blob/b882c60b4023bdf09264c2d5d30a2cadebc240fb/cmd/kube-controller-manager/app/options/endpointslicecontroller.go#L62-L85","documentation":"Validation error from EndpointSliceControllerOptions.Validate() when --max-endpoints-per-slice exceeds 1000 (the maxMaxEndpointsPerSlice constant). Each EndpointSlice is a single API object with size limits; values above 1000 would create oversized objects that risk etcd request limits and API throttling.","triggerScenarios":"Starting kube-controller-manager with --max-endpoints-per-slice set above 1000 (e.g. 5000). Validate() enforces the upper bound.","commonSituations":"Operator tries to minimize the number of EndpointSlice objects by cramming endpoints in, not realizing the 1000 cap; a config map or Helm value is set too high; copy-pasting a value from a non-Kubernetes load balancer max-endpoints setting.","solutions":["Reduce --max-endpoints-per-slice to 1000 or below (default is 100).","Keep the default of 100 unless you have a specific reason to increase it — higher values create larger objects.","Check config files for an inflated maxEndpointsPerSlice value."],"exampleFix":"# before\nkube-controller-manager --max-endpoints-per-slice=5000\n\n# after\nkube-controller-manager --max-endpoints-per-slice=1000","handlingStrategy":"validation","validationCode":"// Validate the max endpoints per slice upper bound before starting:\nconst maxMaxEndpointsPerSlice = 1000\nif o.MaxEndpointsPerSlice > maxMaxEndpointsPerSlice {\n    return fmt.Errorf(\"max-endpoints-per-slice must be <= %d, got %d\", maxMaxEndpointsPerSlice, o.MaxEndpointsPerSlice)\n}","typeGuard":"func isValidMaxEndpointsPerSlice(n int32) bool {\n    return n >= 1 && n <= 1000\n}","tryCatchPattern":null,"preventionTips":["Cap max-endpoints-per-slice at 1000; larger values risk oversized API objects hitting etcd limits.","Validate config values against the [1,1000] bounds in CI before deploying."],"tags":["kubernetes","kube-controller-manager","endpointslice","configuration","flags","validation"],"analyzedSha":"b882c60b4023bdf09264c2d5d30a2cadebc240fb","analyzedAt":"2026-08-07T04:07:48.144Z","schemaVersion":2},"datasetVersion":"2026-08-07T07:17:06.508Z"}