apache/dolphinscheduler · error · ServiceException

1300006

1300006

Error message

k8s error with exception {0}

What it means

When updating a cluster whose config changed (and it is not the local test cluster), updateClusterByCode calls k8sManager.getAndUpdateK8sClient(code, true) to rebuild the Kubernetes client; any exception there is rethrown as ServiceException(Status.K8S_CLIENT_OPS_ERROR, name; code 1300006) with message "k8s error with exception {0}". It signals the new cluster config could not be used to establish a working K8s client, so the update is aborted.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ClusterServiceImpl.java:248

        checkParams(name, config);

        Cluster clusterExistByName = clusterDao.queryByClusterName(name);
        if (clusterExistByName != null && !clusterExistByName.getCode().equals(code)) {
            throw new ServiceException(Status.CLUSTER_NAME_EXISTS, name);
        }

        Cluster clusterExist = clusterDao.queryByClusterCode(code);
        if (clusterExist == null) {
            throw new ServiceException(Status.CLUSTER_NOT_EXISTS, name);
        }

        if (!Constants.K8S_LOCAL_TEST_CLUSTER_CODE.equals(clusterExist.getCode())
                && !config.equals(ClusterConfUtils.getK8sConfig(clusterExist.getConfig()))) {
            try {
                k8sManager.getAndUpdateK8sClient(code, true);
            } catch (Exception e) {
                throw new ServiceException(Status.K8S_CLIENT_OPS_ERROR, name);
            }
        }

        // update cluster
        // need not update relation
        clusterExist.setConfig(config);
        clusterExist.setName(name);
        clusterExist.setDescription(desc);
        clusterExist.setUpdateTime(DateUtils.getCurrentDate());
        clusterDao.updateById(clusterExist);
        return clusterExist;
    }

    /**
     * verify cluster name
     *
     * @param loginUser   login user
     * @param clusterName cluster name

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Validate the new kube config (e.g. kubectl --kubeconfig <file> cluster-info) from the DolphinScheduler API server host before saving.
  2. Check network reachability to the K8s API server (host, port, DNS, firewall) from the API server container/host.
  3. Inspect the wrapped exception message in the API server logs for the root cause (the {0} parameter carries it).
  4. Ensure certificates/keys and tokens in the config are current and correctly indented YAML.
  5. Retry the update once the K8s connection issue is fixed.

Example fix

// before: saving unverified config
String config = newKubeconfigYaml;
clusterService.updateClusterByCode(loginUser, code, name, config, desc);
// after: test the client first
KubeConfigValidation.validateOrThrow(newKubeconfigYaml); // runs kubectl-equivalent check
clusterService.updateClusterByCode(loginUser, code, name, newKubeconfigYaml, desc);
Defensive patterns

Strategy: validation

Validate before calling

// Bash: validate kubeconfig from the API server host before saving
kubectl --kubeconfig /tmp/new-config cluster-info || echo "invalid or unreachable cluster config"

Try / catch

try {
    clusterService.updateClusterByCode(loginUser, code, name, config, desc);
} catch (ServiceException e) {
    if (e.getCode() == 1300006) {
        log.error("K8s client could not be built from new config; check logs for root cause", e);
        // do NOT persist config; roll back UI form state
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: PUT /clusters/{code} with a modified kubeconfig/config field for a non-test cluster where getAndUpdateK8sClient throws — invalid kubeconfig YAML, unreachable API server, bad certificates, wrong context, or expired tokens.

Common situations: Typo in the kube config; K8s API server behind a firewall/VPN not reachable from the API server host; rotated cluster certificates not yet updated in DolphinScheduler; switching contexts to a cluster that was decommissioned.

Related errors


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