{"record":{"id":"7a2bbb078625a953","repo":"apache/dolphinscheduler","slug":"the-driver-pod-does-not-exist","errorCode":null,"errorMessage":"The driver pod does not exist.","messagePattern":"The driver pod does not exist\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"warning","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java","lineNumber":202,"sourceCode":"        ProcessUtils.cancelApplication(taskRequest);\n    }\n\n    private Optional<CompletableFuture<?>> collectPodLogIfNeeded() {\n        if (null == taskRequest.getK8sTaskExecutionContext()) {\n            return Optional.empty();\n        }\n\n        ExecutorService collectPodLogExecutorService = ThreadUtils\n                .newSingleDaemonScheduledExecutorService(\"CollectPodLogOutput-thread-\" + taskRequest.getTaskName());\n\n        final CompletableFuture<Void> collectPodLogFuture = CompletableFuture.runAsync(() -> {\n            // wait for launching (driver) pod\n            ThreadUtils.sleep(SLEEP_TIME_MILLIS * 5L);\n            try (\n                    LogWatch watcher = ProcessUtils.getPodLogWatcher(taskRequest.getK8sTaskExecutionContext(),\n                            taskRequest.getTaskAppId(), \"\")) {\n                if (watcher == null) {\n                    throw new RuntimeException(\"The driver pod does not exist.\");\n                } else {\n                    String line;\n                    try (BufferedReader reader = new BufferedReader(new InputStreamReader(watcher.getOutput()))) {\n                        while ((line = reader.readLine()) != null) {\n                            log.info(\"[K8S-pod-log-{}]: {}\", taskRequest.getTaskName(), line);\n                        }\n                    }\n                }\n            } catch (Exception e) {\n                log.error(\"Collect pod log error\", e);\n                throw new RuntimeException(e);\n            }\n        }, collectPodLogExecutorService);\n\n        collectPodLogExecutorService.shutdown();\n        return Optional.of(collectPodLogFuture);\n    }\n","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java#L184-L220","documentation":"collectPodLogIfNeeded throws this when ProcessUtils.getPodLogWatcher returns null, i.e. no log watcher could be attached to the K8s driver pod for the task. The pod-launching-log collection step fails because the driver pod isn't visible/watchable in the cluster.","triggerScenarios":"getPodLogWatcher(k8sTaskExecutionContext, taskAppId, \"\") returns null — the pod with the task's app-id label does not exist yet or at all, the kubeconfig/context in k8sTaskExecutionContext is wrong, or RBAC forbids watching pod logs.","commonSituations":"Pod failed to schedule (CrashLoopBackOff/pending means it exists but startup was too slow); task runs with wrong namespace or kubeconfig; service account lacks get/watch on pods/log; submitting cluster differs from where pod was expected.","solutions":["Check the driver pod exists: kubectl get pods with the task's label/app-id in the target namespace","Verify the K8s connection config (kubeconfig, namespace, api-version) in the task's k8sTaskExecutionContext","Ensure the service account has pods/log watch RBAC permissions","Check pod events for scheduling failures (resource limits, image pull)","Increase the wait before log collection if the pod starts slowly"],"exampleFix":"// before\nif (watcher == null) {\n    throw new RuntimeException(\"The driver pod does not exist.\");\n}\n// after\nif (watcher == null) {\n    log.warn(\"Driver pod {} not found yet; skipping pod log collection\", taskRequest.getTaskAppId());\n    return;\n}","handlingStrategy":"fallback","validationCode":"// before the task: verify cluster access and pod visibility\nkubectl get pods -n <namespace> -l <app-id-label>\n// or programmatically verify kubeconfig + RBAC via a list-pods probe","typeGuard":null,"tryCatchPattern":"try {\n    executor.run();\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"The driver pod does not exist\")) {\n        log.warn(\"Skipping pod log collection; pod not found for {}\", appId);\n    } else {\n        throw e;\n    }\n}","preventionTips":["Verify K8s context/namespace in the task execution context before submitting","Ensure RBAC allows watch on pods/log","Check pod scheduling (resources, image pull) if pods appear late","Treat missing pod logs as non-fatal — job result is in the process exit code"],"tags":["kubernetes","pod","log-collection"],"backgroundTag":"resource-not-found","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}