{"record":{"id":"71ccc515beaeb81e","repo":"zhisheng17/flink-learning","slug":"per-job-mode-not-supported-by-active-kubernetes-de","errorCode":null,"errorMessage":"Per-Job Mode not supported by Active Kubernetes deployments.","messagePattern":"Per-Job Mode not supported by Active Kubernetes deployments\\.","errorType":"exception","errorClass":"ClusterDeploymentException","httpStatus":null,"severity":"error","filePath":"flink-learning-k8s/flink-k8s/src/main/java/org/apache/flink/kubernetes/KubernetesClusterDescriptor.java","lineNumber":211,"sourceCode":"\t\t\tKubernetesApplicationClusterEntrypoint.class.getName(),\n\t\t\tclusterSpecification,\n\t\t\tfalse);\n\n\t\ttry (ClusterClient<String> clusterClient = clusterClientProvider.getClusterClient()) {\n\t\t\tLOG.info(\n\t\t\t\t\"Create flink application cluster {} successfully, JobManager Web Interface: {}\",\n\t\t\t\tclusterId,\n\t\t\t\tclusterClient.getWebInterfaceURL());\n\t\t}\n\t\treturn clusterClientProvider;\n\t}\n\n\t@Override\n\tpublic ClusterClientProvider<String> deployJobCluster(\n\t\t\tClusterSpecification clusterSpecification,\n\t\t\tJobGraph jobGraph,\n\t\t\tboolean detached) throws ClusterDeploymentException {\n\t\tthrow new ClusterDeploymentException(\"Per-Job Mode not supported by Active Kubernetes deployments.\");\n\t}\n\n\tprivate ClusterClientProvider<String> deployClusterInternal(\n\t\t\tString entryPoint,\n\t\t\tClusterSpecification clusterSpecification,\n\t\t\tboolean detached) throws ClusterDeploymentException {\n\t\tfinal ClusterEntrypoint.ExecutionMode executionMode = detached ?\n\t\t\tClusterEntrypoint.ExecutionMode.DETACHED\n\t\t\t: ClusterEntrypoint.ExecutionMode.NORMAL;\n\t\tflinkConfig.setString(ClusterEntrypoint.EXECUTION_MODE, executionMode.toString());\n\n\t\tflinkConfig.setString(KubernetesConfigOptionsInternal.ENTRY_POINT_CLASS, entryPoint);\n\n\t\t// Rpc, blob, rest, taskManagerRpc ports need to be exposed, so update them to fixed values.\n\t\tKubernetesUtils.checkAndUpdatePortConfigOption(flinkConfig, BlobServerOptions.PORT, Constants.BLOB_SERVER_PORT);\n\t\tKubernetesUtils.checkAndUpdatePortConfigOption(flinkConfig, TaskManagerOptions.RPC_PORT, Constants.TASK_MANAGER_RPC_PORT);\n\t\tKubernetesUtils.checkAndUpdatePortConfigOption(flinkConfig, RestOptions.BIND_PORT, Constants.REST_PORT);\n","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/zhisheng17/flink-learning/blob/d731cee7618021be56d132cc925102ffff8d75e6/flink-learning-k8s/flink-k8s/src/main/java/org/apache/flink/kubernetes/KubernetesClusterDescriptor.java#L193-L229","documentation":"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.","triggerScenarios":"Any call to deployJobCluster on KubernetesClusterDescriptor, e.g. submitting with the legacy per-job mode path against a Kubernetes cluster.","commonSituations":"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.","solutions":["Switch to application mode: flink run-application -t kubernetes-application ... with the job jar.","Or deploy a session cluster (-t kubernetes-session) and submit jobs to it with flink run.","Remove per-job deployment code paths from custom launchers targeting Kubernetes."],"exampleFix":"// before: per-job style\nflink run -t kubernetes-per-job -c MainClass job.jar\n// after: application mode\nflink run-application -t kubernetes-application -c MainClass job.jar","handlingStrategy":"validation","validationCode":"if (\"kubernetes-per-job\".equals(flinkConfig.get(DeploymentOptions.TARGET))) {\n    throw new UnsupportedOperationException(\"Use kubernetes-application or kubernetes-session\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never call deployJobCluster on the Kubernetes descriptor","Migrate per-job scripts to application mode","Use deploySessionCluster for session workflows"],"tags":["kubernetes","flink","per-job-mode","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"d731cee7618021be56d132cc925102ffff8d75e6","analyzedAt":"2026-09-06T05:35:08.496Z","contentChangedAt":"2026-09-06T05:35:08.496Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}