Hi 卓宇,

如exception中提到的:Connection refused: rancher-test.ziroom.com/10.30.238.18:8081 
<http://rancher-test.ziroom.com/10.30.238.18:8081>。由于session cluster地址不可访问所以job 
graph提交失败了。一般原因是由于Kubernetes集群存在网络隔离,需要适当的设置service才能访问和提交job。

请问你是如何设置的你的session cluster呢,可以访问UI吗?
你的参数kubernetes.rest-service.exposed.type设置的是什么?
你使用Flink的版本又是什么呢?






> On 14 Apr 2022, at 9:25 AM, 陈卓宇 <2572805...@qq.com.INVALID> wrote:
> 
> 按照官方文档进行以下操作:
> # (1) Start Kubernetes session $ ./bin/kubernetes-session.sh 
> -Dkubernetes.cluster-id=my-first-flink-cluster # (2) Submit example job $ 
> ./bin/flink run \     --target kubernetes-session \     
> -Dkubernetes.cluster-id=my-first-flink-cluster \     
> ./examples/streaming/TopSpeedWindowing.jar
> 报错:org.apache.flink.client.program.ProgramInvocationException: The main 
> method caused an error: Failed to execute job 'CarTopSpeedWindowingExample'.
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:360)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:213)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:114)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:816)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:248)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:1058)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1136)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.runtime.security.contexts.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:28)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1136)
> Caused by: org.apache.flink.util.FlinkException: Failed to execute job 
> 'CarTopSpeedWindowingExample'.
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.executeAsync(StreamExecutionEnvironment.java:1918)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.client.program.StreamContextEnvironment.executeAsync(StreamContextEnvironment.java:135)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.client.program.StreamContextEnvironment.execute(StreamContextEnvironment.java:76)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1782)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.streaming.examples.windowing.TopSpeedWindowing.main(TopSpeedWindowing.java:99)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> &nbsp; &nbsp; &nbsp; &nbsp;at java.lang.reflect.Method.invoke(Method.java:498)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:343)
> &nbsp; &nbsp; &nbsp; &nbsp;... 8 more
> Caused by: org.apache.flink.runtime.client.JobSubmissionException: Failed to 
> submit JobGraph.
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.client.program.rest.RestClusterClient.lambda$submitJob$7(RestClusterClient.java:400)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:884)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(CompletableFuture.java:866)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1990)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.runtime.concurrent.FutureUtils.lambda$retryOperationWithDelay$9(FutureUtils.java:390)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1990)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.runtime.rest.RestClient.lambda$submitRequest$1(RestClient.java:430)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:577)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:570)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:549)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:490)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:615)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:608)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:117)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:321)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:337)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:702)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
> &nbsp; &nbsp; &nbsp; &nbsp;at java.lang.Thread.run(Thread.java:748)
> Caused by: org.apache.flink.runtime.concurrent.FutureUtils$RetryException: 
> Could not complete the operation. Number of retries has been exhausted.
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.runtime.concurrent.FutureUtils.lambda$retryOperationWithDelay$9(FutureUtils.java:386)
> &nbsp; &nbsp; &nbsp; &nbsp;... 21 more
> Caused by: java.util.concurrent.CompletionException: 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannel$AnnotatedConnectException:
>  Connection refused: rancher-test.ziroom.com/10.30.238.18:8081
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> java.util.concurrent.CompletableFuture.uniCompose(CompletableFuture.java:957)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:940)
> &nbsp; &nbsp; &nbsp; &nbsp;... 19 more
> Caused by: 
> org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannel$AnnotatedConnectException:
>  Connection refused: rancher-test.ziroom.com/10.30.238.18:8081
> Caused by: java.net.ConnectException: Connection refused
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:330)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:702)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
> &nbsp; &nbsp; &nbsp; &nbsp;at 
> org.apache.flink.shaded.netty4.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
> &nbsp; &nbsp; &nbsp; &nbsp;at java.lang.Thread.run(Thread.java:748)
> 
> 请教大佬我该如何解决此问题?
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 卓
> 
> 
> &nbsp;

回复