{"record":{"id":"e344c11f67477e1e","repo":"kubernetes/kops","slug":"cluster-passed-validation-d-consecutive-times","errorCode":null,"errorMessage":"cluster passed validation %d consecutive times","messagePattern":"cluster passed validation (.+?) consecutive times","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cmd/kops/validate_cluster.go","lineNumber":238,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"unable to marshal JSON: %v\", err)\n\t\t\t}\n\t\t\tif _, err := out.Write(j); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error writing to output: %v\", err)\n\t\t\t}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown output format: %q\", options.output)\n\t\t}\n\n\t\tif len(result.Failures) == 0 {\n\t\t\tconsecutive++\n\t\t\tif consecutive < options.count {\n\t\t\t\tklog.Infof(\"(will retry): cluster passed validation %d consecutive times\", consecutive)\n\t\t\t\tif options.wait > 0 {\n\t\t\t\t\ttime.Sleep(options.interval)\n\t\t\t\t\tcontinue\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, fmt.Errorf(\"cluster passed validation %d consecutive times\", consecutive)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn result, nil\n\t\t\t}\n\t\t} else {\n\t\t\tif options.wait > 0 {\n\t\t\t\tklog.Warningf(\"(will retry): cluster not yet healthy\")\n\t\t\t\tconsecutive = 0\n\t\t\t\ttime.Sleep(options.interval)\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\treturn nil, fmt.Errorf(\"cluster not yet healthy\")\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc validateClusterOutputTable(result *validation.ValidationCluster, cluster *kopsapi.Cluster, instanceGroups []kopsapi.InstanceGroup, out io.Writer) error {","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/validate_cluster.go#L220-L256","documentation":"With --wait set, a fully passing validation must occur options.count consecutive times before success. If the wait window expires while the cluster has passed validation fewer than count times (consecutive < count) and --wait is set, the loop returns this error instead of sleeping past the deadline. So the cluster is healthy but not consistently validated for long enough within the allowed time.","triggerScenarios":"`kops validate cluster --wait 1m --count 3 --interval 30s` where validation succeeds twice but the timeout expires before the third consecutive pass.","commonSituations":"Large --count with small --wait; flaky validation where a transient failure resets consecutive to 0; slow API responses eating the interval budget.","solutions":["Increase --wait so count consecutive passes fit: wait >= count * interval plus margin.","Reduce --count if you only need a single stable pass.","Increase --interval only if the API is rate-limited; otherwise keep it small so more attempts fit in wait.","Investigate what intermittently resets consecutive (a failing node or pod) via `kubectl get nodes,pods -A`.","Run without --wait when a single validation snapshot is sufficient."],"exampleFix":"// before\nkops validate cluster --wait 1m --count 5 --interval 30s\n// after\nkops validate cluster --wait 10m --count 5 --interval 30s","handlingStrategy":"validation","validationCode":"interval, _ := time.ParseDuration(\"30s\")\ncount := 3\nwait, _ := time.ParseDuration(\"5m\")\nif wait < time.Duration(count)*interval {\n\treturn fmt.Errorf(\"--wait (%s) must exceed count*interval (%s)\", wait, time.Duration(count)*interval)\n}","typeGuard":null,"tryCatchPattern":"err := runValidate(ctx, opts)\nif err != nil && strings.Contains(err.Error(), \"cluster passed validation\") {\n\t// healthy but not stable long enough: extend wait or lower count\n\treturn runValidate(ctx, withWait(opts, 2*opts.Wait))\n}","preventionTips":["Ensure wait >= count * interval before running.","Avoid intermittent failures resetting consecutive passes by fixing flaky nodes/pods first.","Omit --wait when a single passing snapshot suffices.","Keep --interval modest so enough attempts fit inside the window."],"tags":["kubernetes","validation","timeout"],"backgroundTag":"wait-timeout-during-validation","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"}