{"record":{"id":"cf8bb21988e39750","repo":"kubernetes/kops","slug":"cannot-create-cluster-validator-v","errorCode":null,"errorMessage":"cannot create cluster validator: %v","messagePattern":"cannot create cluster validator: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/delete_instance.go","lineNumber":268,"sourceCode":"\t\tCloud:             cloud,\n\t\tK8sClient:         k8sClient,\n\t\tFailOnDrainError:  options.FailOnDrainError,\n\t\tFailOnValidate:    options.FailOnValidate,\n\t\tCloudOnly:         options.CloudOnly,\n\t\tClusterName:       options.ClusterName,\n\t\tPostDrainDelay:    options.PostDrainDelay,\n\t\tValidationTimeout: options.ValidationTimeout,\n\t\tValidateCount:     int(options.ValidateCount),\n\t\t// TODO should we expose this to the UI?\n\t\tValidateTickDuration:    30 * time.Second,\n\t\tValidateSuccessDuration: 10 * time.Second,\n\t}\n\n\tvar clusterValidator validation.ClusterValidator\n\tif !options.CloudOnly {\n\t\tclusterValidator, err = validation.NewClusterValidator(cluster, cloud, list, nil, nil, 0, restConfig, k8sClient)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot create cluster validator: %v\", err)\n\t\t}\n\t}\n\td.ClusterValidator = clusterValidator\n\n\treturn d.UpdateSingleInstance(ctx, cloudMember, options.Surge)\n}\n\nfunc getNodes(ctx context.Context, kubeClient kubernetes.Interface, verbose bool) ([]v1.Node, error) {\n\tvar nodes []v1.Node\n\n\tnodeList, err := kubeClient.CoreV1().Nodes().List(ctx, metav1.ListOptions{})\n\tif err != nil {\n\t\tif verbose {\n\t\t\tfmt.Fprintf(os.Stderr, \"Unable to reach the kubernetes API.\\n\")\n\t\t\tfmt.Fprintf(os.Stderr, \"Use --cloudonly to do a deletion without confirming progress with the k8s API\\n\\n\")\n\t\t}\n\t\treturn nil, fmt.Errorf(\"listing nodes in cluster: %v\", err)\n\t}","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/delete_instance.go#L250-L286","documentation":"RunDeleteInstance returns this when validation.NewClusterValidator fails to construct the rolling-update cluster validator used to health-check the cluster after the instance is deleted. NewClusterValidator validates its inputs (cluster, cloud, instance group list, REST config, k8s client) and returns an error if it cannot assemble a working validator.","triggerScenarios":"`kops delete instance` without --cloudonly, after the instance was found and --yes given, where validation.NewClusterValidator(cluster, cloud, list, nil, nil, 0, restConfig, k8sClient) returns a non-nil error — e.g. nil or unusable restConfig/k8sClient, an incomplete instance group list, or an invalid cloud/cluster combination.","commonSituations":"Corrupt REST config slipping past client creation but failing validator setup; instance group list from the state store missing or partially loaded; a recent kops/client-go version change changing NewClusterValidator requirements; cluster spec in the state store inconsistent with the live cloud (BuildCloud succeeded but validator setup disagrees).","solutions":["Inspect the wrapped %v error from NewClusterValidator — it names the specific validation/setup failure.","Regenerate credentials with `kops export kubecfg <cluster> --admin` and retry, ruling out bad REST config/k8s client inputs.","Verify instance groups are intact: `kops get ig --name <cluster> -oyaml`; fix the state store if entries are missing/corrupt.","Confirm the kops binary version matches your cluster spec version (kops upgrade cluster / kops update cluster as needed).","If the k8s API is unreachable anyway, use --cloudonly, which skips validator creation."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure inputs to the validator are sound before calling it:\nif restConfig == nil || k8sClient == nil {\n    return fmt.Errorf(\"restConfig and k8sClient are required for cluster validation; use --cloudonly to skip\")\n}\nif len(list.Items) == 0 {\n    return fmt.Errorf(\"no instance groups found for cluster %q; state store may be incomplete\", cluster.Name)\n}","typeGuard":null,"tryCatchPattern":"clusterValidator, err := validation.NewClusterValidator(cluster, cloud, list, nil, nil, 0, restConfig, k8sClient)\nif err != nil {\n    return fmt.Errorf(\"cannot create cluster validator: %v\", err)\n}\nd.ClusterValidator = clusterValidator","preventionTips":["Keep the kops binary and cluster spec versions aligned (run kops upgrade when upgrading).","Verify state store integrity with `kops get ig -oyaml` before rolling updates.","Regenerate kubecfg after cert rotation so validator TLS setup succeeds.","Prefer --cloudonly when validation prerequisites cannot be met."],"tags":["kops","validation","rolling-update","cluster-validator"],"backgroundTag":"validator-initialization-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"}