日志里面已经说明的比较清楚了,如果用的是ClusterIP的方式,那你的Flink client必须在k8s集群内才能正常提交。例如:起一个Pod,然后再pod里面执行flink run 否则你就需要NodePort或者LoadBalancer的方式了
2022-07-12 10:23:23,021 WARN org.apache.flink.kubernetes.KubernetesClusterDescriptor [] - Please note that Flink client operations(e.g. cancel, list, stop, savepoint, etc.) won't work from outside the Kubernetes cluster since 'kubernetes.rest-service.exposed.type' has been set to ClusterIP. Best, Yang yidan zhao <hinobl...@gmail.com> 于2022年7月12日周二 10:40写道: > 如下步骤参考的文档 > https://nightlies.apache.org/flink/flink-docs-release-1.15/docs/deployment/resource-providers/native_kubernetes/#starting-a-flink-session-on-kubernetes > > 版本:1.15 > > (1)创建集群: > > https://nightlies.apache.org/flink/flink-docs-release-1.15/docs/deployment/resource-providers/native_kubernetes/#starting-a-flink-session-on-kubernetes > (2)提交任务: > ./bin/flink run \ > --target kubernetes-session \ > -Dkubernetes.cluster-id=my-first-flink-cluster \ > ./examples/streaming/TopSpeedWindowing.jar > > svc是ClusterIp类型 > > 第二步提交任务环节,显示如下: > Executing example with default input data. > Use --input to specify file input. > Printing result to stdout. Use --output to specify output path. > 2022-07-12 10:23:23,021 WARN > org.apache.flink.kubernetes.KubernetesClusterDescriptor [] - > Please note that Flink client operations(e.g. cancel, list, stop, > savepoint, etc.) won't work from outside the Kubernetes cluster since > 'kubernetes.rest-service.exposed.type' has been set to ClusterIP. > 2022-07-12 10:23:23,027 INFO > org.apache.flink.kubernetes.KubernetesClusterDescriptor [] - > Retrieve flink cluster my-first-flink-cluster successfully, JobManager > Web Interface: http://my-first-flink-cluster-rest.test:8081 > 2022-07-12 10:23:23,044 WARN > org.apache.flink.kubernetes.KubernetesClusterDescriptor [] - > Please note that Flink client operations(e.g. cancel, list, stop, > savepoint, etc.) won't work from outside the Kubernetes cluster since > 'kubernetes.rest-service.exposed.type' has been set to ClusterIP. > > ------------------------------------------------------------ > The program finished with the following exception: > org.apache.flink.client.program.ProgramInvocationException: The main > method caused an error: Failed to execute job > 'CarTopSpeedWindowingExample'. > ... > Caused by: org.apache.flink.util.FlinkException: Failed to execute job > 'CarTopSpeedWindowingExample'. > ... > Caused by: org.apache.flink.runtime.client.JobSubmissionException: > Failed to submit JobGraph. > ... > Caused by: org.apache.flink.util.concurrent.FutureUtils$RetryException: > Could not complete the operation. Number of retries has been > exhausted. > ... > Caused by: java.util.concurrent.CompletionException: > java.net.UnknownHostException: my-first-flink-cluster-rest.test: Name > or service not known > ... > Caused by: java.net.UnknownHostException: > my-first-flink-cluster-rest.test: Name or service not known > > > 如上,根据 --target kubernetes-session > -Dkubernetes.cluster-id=my-first-flink-cluster 找到的提交入口为 > my-first-flink-cluster-rest.test。这个应该是根据k8s生成的dns,test是flink的namespace。 > > 我本地也的确并无法解析 my-first-flink-cluster-rest.test 这个。 >