zhisheng17/flink-learning · error · ClusterDeploymentException

Per-Job Mode not supported by Active Kubernetes deployments.

Error message

Per-Job Mode not supported by Active Kubernetes deployments.

What it means

deployJobCluster unconditionally throws this ClusterDeploymentException: Per-Job mode is not implemented for active Kubernetes deployments. Callers must use session (deploySessionCluster) or application (deployApplicationCluster) mode instead.

Source

Thrown at flink-learning-k8s/flink-k8s/src/main/java/org/apache/flink/kubernetes/KubernetesClusterDescriptor.java:211

			KubernetesApplicationClusterEntrypoint.class.getName(),
			clusterSpecification,
			false);

		try (ClusterClient<String> clusterClient = clusterClientProvider.getClusterClient()) {
			LOG.info(
				"Create flink application cluster {} successfully, JobManager Web Interface: {}",
				clusterId,
				clusterClient.getWebInterfaceURL());
		}
		return clusterClientProvider;
	}

	@Override
	public ClusterClientProvider<String> deployJobCluster(
			ClusterSpecification clusterSpecification,
			JobGraph jobGraph,
			boolean detached) throws ClusterDeploymentException {
		throw new ClusterDeploymentException("Per-Job Mode not supported by Active Kubernetes deployments.");
	}

	private ClusterClientProvider<String> deployClusterInternal(
			String entryPoint,
			ClusterSpecification clusterSpecification,
			boolean detached) throws ClusterDeploymentException {
		final ClusterEntrypoint.ExecutionMode executionMode = detached ?
			ClusterEntrypoint.ExecutionMode.DETACHED
			: ClusterEntrypoint.ExecutionMode.NORMAL;
		flinkConfig.setString(ClusterEntrypoint.EXECUTION_MODE, executionMode.toString());

		flinkConfig.setString(KubernetesConfigOptionsInternal.ENTRY_POINT_CLASS, entryPoint);

		// Rpc, blob, rest, taskManagerRpc ports need to be exposed, so update them to fixed values.
		KubernetesUtils.checkAndUpdatePortConfigOption(flinkConfig, BlobServerOptions.PORT, Constants.BLOB_SERVER_PORT);
		KubernetesUtils.checkAndUpdatePortConfigOption(flinkConfig, TaskManagerOptions.RPC_PORT, Constants.TASK_MANAGER_RPC_PORT);
		KubernetesUtils.checkAndUpdatePortConfigOption(flinkConfig, RestOptions.BIND_PORT, Constants.REST_PORT);

View on GitHub (pinned to d731cee761)

Solutions

  1. Switch to application mode: flink run-application -t kubernetes-application ... with the job jar.
  2. Or deploy a session cluster (-t kubernetes-session) and submit jobs to it with flink run.
  3. Remove per-job deployment code paths from custom launchers targeting Kubernetes.

Example fix

// before: per-job style
flink run -t kubernetes-per-job -c MainClass job.jar
// after: application mode
flink run-application -t kubernetes-application -c MainClass job.jar
Defensive patterns

Strategy: validation

Validate before calling

if ("kubernetes-per-job".equals(flinkConfig.get(DeploymentOptions.TARGET))) {
    throw new UnsupportedOperationException("Use kubernetes-application or kubernetes-session");
}

Prevention

When it happens

Trigger: Any call to deployJobCluster on KubernetesClusterDescriptor, e.g. submitting with the legacy per-job mode path against a Kubernetes cluster.

Common situations: Migrating a YARN per-job submission script to Kubernetes; older tooling that still targets per-job mode; following outdated Flink documentation; -t kubernetes per-job style invocations.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of zhisheng17/flink-learning@d731cee761 (2026-09-06). Data as JSON: /api/errors/71ccc515beaeb81e. Report an issue: GitHub.