{"record":{"id":"6a10dbb86d9f8c94","repo":"GoogleContainerTools/skaffold","slug":"creating-verify-job-in-cluster","errorCode":null,"errorMessage":"creating verify job in cluster","messagePattern":"creating verify job in cluster","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/verify/k8sjob/verify.go","lineNumber":224,"sourceCode":"\n\tv.TrackContainerAndJobFromBuild(graph.Artifact{\n\t\tImageName: tc.Container.Name,\n\t\tTag:       tc.Name,\n\t}, tracker.Job{Name: tc.Container.Name, ID: job.Name}, job)\n\n\t// This retrying is added as when attempting to kickoff multiple jobs simultaneously\n\t// This is because the k8s API server can be unresponsive when hit with a large\n\t// intitial set of Job CREATE requests\n\tif waitErr := wait.Poll(100*time.Millisecond, 30*time.Second, func() (bool, error) {\n\t\t_, err = clientset.BatchV1().Jobs(job.Namespace).Create(ctx, job, metav1.CreateOptions{})\n\t\tif err != nil {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, nil\n\t}); waitErr != nil {\n\t\tif ctx.Err() != context.Canceled {\n\t\t\teventV2.VerifyFailed(tc.Name, err)\n\t\t\treturn errors.Wrap(err, \"creating verify job in cluster\")\n\t\t}\n\t}\n\n\tvar timeoutDuration *time.Duration = nil\n\tif tc.Config.Timeout != nil {\n\t\ttimeoutDuration = util.Ptr(time.Second * time.Duration(*tc.Config.Timeout))\n\t}\n\n\tvar execErr error\n\texecCh := make(chan error)\n\tgo func() {\n\t\texecCh <- v.watchJob(ctx, clientset, job, tc)\n\t\tclose(execCh)\n\t}()\n\n\tselect {\n\tcase execErr = <-execCh:\n\tcase <-v.timeout(timeoutDuration):","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/verify/k8sjob/verify.go#L206-L242","documentation":"The k8sjob verify runner failed while waiting for the verify Job to be created in the cluster. On wait errors (other than context cancellation), the test is marked failed and the error 'creating verify job in cluster' wraps the underlying kube API error.","triggerScenarios":"createAndRunJob's wait.PollImmediate (via waitExponentialBackoff) returns waitErr and ctx.Err() != context.Canceled — job creation API call fails or the job never appears within the backoff window.","commonSituations":"Insufficient RBAC to create batch/v1 Jobs in the namespace; invalid job spec rejected by the API server; namespace missing; cluster unreachable; context deadline hit before job creation.","solutions":["Check RBAC: user/serviceaccount needs 'create jobs' permission (`kubectl auth can-i create jobs -n <ns>`)","Confirm the namespace exists and cluster is reachable (`kubectl get ns`)","Inspect the wrapped kube error for validation messages on the job spec","Increase timeouts or fix connectivity, then rerun `skaffold verify`"],"exampleFix":"// before: verify runs against namespace without job permissions\nverify: [...]\n// after: run in a namespace with RBAC\nskaffold verify --namespace verify-ns","handlingStrategy":"validation","validationCode":"// Pre-check job creation RBAC\nif err := exec.Command(\"kubectl\", \"auth\", \"can-i\", \"create\", \"jobs\", \"-n\", ns).Run(); err != nil {\n    return fmt.Errorf(\"serviceaccount cannot create jobs in namespace %s\", ns)\n}","typeGuard":null,"tryCatchPattern":"if err := verifier.Verify(ctx, out, tc); err != nil {\n    if strings.Contains(err.Error(), \"creating verify job in cluster\") {\n        return fmt.Errorf(\"could not create verify job (check RBAC/namespace): %w\", err)\n    }\n    return err\n}","preventionTips":["Grant the SA permissions to create batch/v1 Jobs in the target namespace","Verify the namespace exists before running `skaffold verify`","Test cluster connectivity with `kubectl get ns` first"],"tags":["kubernetes","verify","job-creation","rbac"],"backgroundTag":"kubernetes-job-creation-failed","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}