{"record":{"id":"452512cdf56911f0","repo":"kubernetes/kops","slug":"getting-rest-config-w-452512","errorCode":null,"errorMessage":"getting rest config: %w","messagePattern":"getting rest config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/validate_cluster.go","lineNumber":167,"sourceCode":"\t}\n\n\tif options.output == OutputTable {\n\t\tfmt.Fprintf(out, \"Validating cluster %v\\n\\n\", cluster.ObjectMeta.Name)\n\t}\n\n\tvar instanceGroups []kopsapi.InstanceGroup\n\tfor _, ig := range list.Items {\n\t\tinstanceGroups = append(instanceGroups, ig)\n\t\tklog.V(2).Infof(\"instance group: %#v\\n\\n\", ig.Spec)\n\t}\n\n\tif len(instanceGroups) == 0 {\n\t\treturn nil, fmt.Errorf(\"no InstanceGroup objects found\")\n\t}\n\n\trestConfig, err := f.RESTConfig(ctx, cluster, options.CreateKubecfgOptions)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting rest config: %w\", err)\n\t}\n\n\thttpClient, err := f.HTTPClient(restConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting http client: %w\", err)\n\t}\n\n\tk8sClient, err := kubernetes.NewForConfigAndClient(restConfig, httpClient)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"building kubernetes client: %w\", err)\n\t}\n\n\ttimeout := time.Now().Add(options.wait)\n\n\tvalidator, err := validation.NewClusterValidator(cluster, cloud, list, options.filterInstanceGroups, options.filterPodsForValidation, options.MaxUnreadyNodes, restConfig, k8sClient)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unexpected error creating validatior: %v\", err)\n\t}","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/validate_cluster.go#L149-L185","documentation":"Wraps a failure of f.RESTConfig in RunValidateCluster: kOps could not build a REST config (connection settings/credentials) for the cluster's API server, so validation cannot query the Kubernetes API.","triggerScenarios":"Thrown at cmd/kops/validate_cluster.go:167 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run kops export kubecfg to refresh credentials","Verify the API server endpoint is reachable","Check kubeconfig TLS/CA data"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}