apache/dolphinscheduler · warning · RuntimeException

The driver pod does not exist.

Error message

The driver pod does not exist.

What it means

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.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java:202

        ProcessUtils.cancelApplication(taskRequest);
    }

    private Optional<CompletableFuture<?>> collectPodLogIfNeeded() {
        if (null == taskRequest.getK8sTaskExecutionContext()) {
            return Optional.empty();
        }

        ExecutorService collectPodLogExecutorService = ThreadUtils
                .newSingleDaemonScheduledExecutorService("CollectPodLogOutput-thread-" + taskRequest.getTaskName());

        final CompletableFuture<Void> collectPodLogFuture = CompletableFuture.runAsync(() -> {
            // wait for launching (driver) pod
            ThreadUtils.sleep(SLEEP_TIME_MILLIS * 5L);
            try (
                    LogWatch watcher = ProcessUtils.getPodLogWatcher(taskRequest.getK8sTaskExecutionContext(),
                            taskRequest.getTaskAppId(), "")) {
                if (watcher == null) {
                    throw new RuntimeException("The driver pod does not exist.");
                } else {
                    String line;
                    try (BufferedReader reader = new BufferedReader(new InputStreamReader(watcher.getOutput()))) {
                        while ((line = reader.readLine()) != null) {
                            log.info("[K8S-pod-log-{}]: {}", taskRequest.getTaskName(), line);
                        }
                    }
                }
            } catch (Exception e) {
                log.error("Collect pod log error", e);
                throw new RuntimeException(e);
            }
        }, collectPodLogExecutorService);

        collectPodLogExecutorService.shutdown();
        return Optional.of(collectPodLogFuture);
    }

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Check the driver pod exists: kubectl get pods with the task's label/app-id in the target namespace
  2. Verify the K8s connection config (kubeconfig, namespace, api-version) in the task's k8sTaskExecutionContext
  3. Ensure the service account has pods/log watch RBAC permissions
  4. Check pod events for scheduling failures (resource limits, image pull)
  5. Increase the wait before log collection if the pod starts slowly

Example fix

// before
if (watcher == null) {
    throw new RuntimeException("The driver pod does not exist.");
}
// after
if (watcher == null) {
    log.warn("Driver pod {} not found yet; skipping pod log collection", taskRequest.getTaskAppId());
    return;
}
Defensive patterns

Strategy: fallback

Validate before calling

// before the task: verify cluster access and pod visibility
kubectl get pods -n <namespace> -l <app-id-label>
// or programmatically verify kubeconfig + RBAC via a list-pods probe

Try / catch

try {
    executor.run();
} catch (RuntimeException e) {
    if (e.getMessage().contains("The driver pod does not exist")) {
        log.warn("Skipping pod log collection; pod not found for {}", appId);
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/7a2bbb078625a953. Report an issue: GitHub.