0

I have deployed a k8s local deployment of flink on minikube by using their helm chart: helm install -n flink riskfocus/flink --generate-name After that, on my PC I opened localhost:8081/ and I do see the UI as it should, with 4 available task slots and 0 jobs.

Now I want to send jobs using my CLI, not the UI. Mainly because I have pyspark .py files that (as far as I understand), I can't upload via the UI since it only takes .jar files . But the flink CLI has the option to take .py files and submit jobs via flink run --python <path_to.py> as per the documentation here

My problem is that I am on a windows machine. So the flink CLI doesn't works, as the docs state it's only for UNIX. But I am doing a workaround and I need help.But I saw flink also has a docker image, which contains the CLI since the image is on a UNIX-like system. https://hub.docker.com/_/flink/

So I ran docker pull flink

And then my plan was to put that into a running container using host network, so that it could use flink commands inside the container and it would send them to its container's localhost 8081, but since the contianer is on host network, it would be going straight to my host machine's 8081, where my kubernete's nodeport is listening.

Therefore, once I got the container, I ran docker run -d -it --name flink_client --network host flink bash . To get the container running. I then entered the container via docker exec -it flink_client bash And once inside I saw the flink folder. Which has the /bin, /examples, /conf and other directories. Inside the opt/flink/bin I am able to run the flink CLI finally.

Now I had to tell to flink CLI (running inside a container on network host) to point to my kubernetes cluster, I managed that via the flink run.So I ran flink run -m localhost:8081 /opt/flink/examples/batch/WordCount.jar

My assumption is that, since this command is running inside a container that is on host network, that command (which specifies localhost:8081 as the master) should send the request precisely to my host machine to port 8081, as if it was the master. Then, since my machine is already using port 8081 for the k8s service of flink, it should have got that command.

But the command in docker fails, so in the UI at the browser 1ocalhost:8081\ I don't even see a job scheduled or anything. It's on 0s, as if the communication between the CLI command of the container didn't even reached the k8s.

Any pointers to what I could be doing wrong? Here is the error that the CLI command of the container gives:

command ran: flink run -m localhost:80801 /opt/flink/examples/batch/WordCount.jar

At first it shows these logs and pauses for some 30 seconds:

Executing WordCount example with default input data set. Use --input to specify file input. Printing result to stdout. Use --output to specify output path.

Then it throws this storm of Java errors

    Executing WordCount example with default input data set.
    Use --input to specify file input.
    Printing result to stdout. Use --output to specify output path.
    
    ------------------------------------------------------------
     The program finished with the following exception:
    
    org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: java.util.concurrent.ExecutionException: org.apache.flink.runtime.client.JobSubmissionException: Failed to submit JobGraph.
            at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:372)
            at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:222)
            at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:105)
            at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:851)
            at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:245)
            at org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:1095)
            at org.apache.flink.client.cli.CliFrontend.lambda$mainInternal$9(CliFrontend.java:1189)
            at org.apache.flink.runtime.security.contexts.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:28)
            at org.apache.flink.client.cli.CliFrontend.mainInternal(CliFrontend.java:1189)
            at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1157)
    Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: org.apache.flink.runtime.client.JobSubmissionException: Failed to submit JobGraph.
            at org.apache.flink.util.ExceptionUtils.rethrow(ExceptionUtils.java:321)
            at org.apache.flink.api.java.ExecutionEnvironment.executeAsync(ExecutionEnvironment.java:1061)
            at org.apache.flink.client.program.ContextEnvironment.executeAsync(ContextEnvironment.java:144)
            at org.apache.flink.client.program.ContextEnvironment.execute(ContextEnvironment.java:73)
            at org.apache.flink.api.java.ExecutionEnvironment.execute(ExecutionEnvironment.java:942)
            at org.apache.flink.api.java.DataSet.collect(DataSet.java:417)
            at org.apache.flink.api.java.DataSet.print(DataSet.java:1748)
            at org.apache.flink.examples.java.wordcount.WordCount.main(WordCount.java:96)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.base/java.lang.reflect.Method.invoke(Unknown Source)
            at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:355)
            ... 9 more
    Caused by: java.util.concurrent.ExecutionException: org.apache.flink.runtime.client.JobSubmissionException: Failed to submit JobGraph.       
            at java.base/java.util.concurrent.CompletableFuture.reportGet(Unknown Source)
            at java.base/java.util.concurrent.CompletableFuture.get(Unknown Source)
            at org.apache.flink.api.java.ExecutionEnvironment.executeAsync(ExecutionEnvironment.java:1056)
            ... 20 more
    Caused by: org.apache.flink.runtime.client.JobSubmissionException: Failed to submit JobGraph.
            at org.apache.flink.client.program.rest.RestClusterClient.lambda$submitJob$11(RestClusterClient.java:451)
            at java.base/java.util.concurrent.CompletableFuture.uniExceptionally(Unknown Source)
            at java.base/java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(Unknown Source)
            at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
            at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(Unknown Source)
            at org.apache.flink.util.concurrent.FutureUtils.lambda$retryOperationWithDelay$6(FutureUtils.java:298)
            at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(Unknown Source)
            at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(Unknown Source)
            at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
            at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(Unknown Source)
            at org.apache.flink.runtime.rest.RestClient.lambda$submitRequest$1(RestClient.java:480)
            at org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:578)
            at org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:571)
            at org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:550)
            at org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:491)
            at org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:616)
            at org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:609)
            at org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:117)
            at org.apache.flink.shaded.netty4.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:321)
            at org.apache.flink.shaded.netty4.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:337)
            at org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776)
            at org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
            at org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
            at org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
            at org.apache.flink.shaded.netty4.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)       
            at org.apache.flink.shaded.netty4.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
            at java.base/java.lang.Thread.run(Unknown Source)
    Caused by: org.apache.flink.util.concurrent.FutureUtils$RetryException: Could not complete the operation. Number of retries has been exhausted.
            at org.apache.flink.util.concurrent.FutureUtils.lambda$retryOperationWithDelay$6(FutureUtils.java:294)
            ... 21 more
    Caused by: java.util.concurrent.CompletionException: org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: /0.0.0.0:8081
            at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
            at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
            at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(Unknown Source)
            ... 19 more
    Caused by: org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: /0.0.0.0:8081      
    Caused by: java.net.ConnectException: Connection refused
            at java.base/sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
            at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
            at org.apache.flink.shaded.netty4.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:337)
            at org.apache.flink.shaded.netty4.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334)
            at org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776)
            at org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
            at org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
            at org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
            at org.apache.flink.shaded.netty4.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)       
            at org.apache.flink.shaded.netty4.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
            at java.base/java.lang.Thread.run(Unknown Source)


  [1]: https://Executing%20WordCount%20example%20with%20default%20input%20data%20set.%20Use%20--input%20to%20specify%20file%20input.%20Printing%20result%20to%20stdout.%20Use%20--output%20to%20specify%20output%20path.%20%20------------------------------------------------------------%20%20The%20program%20finished%20with%20the%20following%20exception:%20%20org.apache.flink.client.program.ProgramInvocationException:%20The%20main%20method%20caused%20an%20error:%20java.util.concurrent.ExecutionException:%20org.apache.flink.runtime.client.JobSubmissionException:%20Failed%20to%20submit%20JobGraph.%20%20%20%20%20%20%20%20%20at%20org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:372)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:222)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:105)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:851)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:245)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:1095)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.client.cli.CliFrontend.lambda$mainInternal$9(CliFrontend.java:1189)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.runtime.security.contexts.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:28)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.client.cli.CliFrontend.mainInternal(CliFrontend.java:1189)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1157)%20Caused%20by:%20java.lang.RuntimeException:%20java.util.concurrent.ExecutionException:%20org.apache.flink.runtime.client.JobSubmissionException:%20Failed%20to%20submit%20JobGraph.%20%20%20%20%20%20%20%20%20at%20org.apache.flink.util.ExceptionUtils.rethrow(ExceptionUtils.java:321)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.api.java.ExecutionEnvironment.executeAsync(ExecutionEnvironment.java:1061)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.client.program.ContextEnvironment.executeAsync(ContextEnvironment.java:144)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.client.program.ContextEnvironment.execute(ContextEnvironment.java:73)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.api.java.ExecutionEnvironment.execute(ExecutionEnvironment.java:942)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.api.java.DataSet.collect(DataSet.java:417)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.api.java.DataSet.print(DataSet.java:1748)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.examples.java.wordcount.WordCount.main(WordCount.java:96)%20%20%20%20%20%20%20%20%20at%20java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native%20Method)%20%20%20%20%20%20%20%20%20at%20java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown%20Source)%20%20%20%20%20%20%20%20%20at%20java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown%20Source)%20%20%20%20%20%20%20%20%20at%20java.base/java.lang.reflect.Method.invoke(Unknown%20Source)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:355)%20%20%20%20%20%20%20%20%20...%209%20more%20Caused%20by:%20java.util.concurrent.ExecutionException:%20org.apache.flink.runtime.client.JobSubmissionException:%20Failed%20to%20submit%20JobGraph.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20at%20java.base/java.util.concurrent.CompletableFuture.reportGet(Unknown%20Source)%20%20%20%20%20%20%20%20%20at%20java.base/java.util.concurrent.CompletableFuture.get(Unknown%20Source)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.api.java.ExecutionEnvironment.executeAsync(ExecutionEnvironment.java:1056)%20%20%20%20%20%20%20%20%20...%2020%20more%20Caused%20by:%20org.apache.flink.runtime.client.JobSubmissionException:%20Failed%20to%20submit%20JobGraph.%20%20%20%20%20%20%20%20%20at%20org.apache.flink.client.program.rest.RestClusterClient.lambda$submitJob$11(RestClusterClient.java:451)%20%20%20%20%20%20%20%20%20at%20java.base/java.util.concurrent.CompletableFuture.uniExceptionally(Unknown%20Source)%20%20%20%20%20%20%20%20%20at%20java.base/java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(Unknown%20Source)%20%20%20%20%20%20%20%20%20at%20java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown%20Source)%20%20%20%20%20%20%20%20%20at%20java.base/java.util.concurrent.CompletableFuture.completeExceptionally(Unknown%20Source)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.util.concurrent.FutureUtils.lambda$retryOperationWithDelay$6(FutureUtils.java:298)%20%20%20%20%20%20%20%20%20at%20java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(Unknown%20Source)%20%20%20%20%20%20%20%20%20at%20java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(Unknown%20Source)%20%20%20%20%20%20%20%20%20at%20java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown%20Source)%20%20%20%20%20%20%20%20%20at%20java.base/java.util.concurrent.CompletableFuture.completeExceptionally(Unknown%20Source)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.runtime.rest.RestClient.lambda$submitRequest$1(RestClient.java:480)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:578)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:571)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:550)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:491)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:616)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:609)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:117)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:321)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:337)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)%20%20%20%20%20%20%20%20%20at%20java.base/java.lang.Thread.run(Unknown%20Source)%20Caused%20by:%20org.apache.flink.util.concurrent.FutureUtils$RetryException:%20Could%20not%20complete%20the%20operation.%20Number%20of%20retries%20has%20been%20exhausted.%20%20%20%20%20%20%20%20%20at%20org.apache.flink.util.concurrent.FutureUtils.lambda$retryOperationWithDelay$6(FutureUtils.java:294)%20%20%20%20%20%20%20%20%20...%2021%20more%20Caused%20by:%20java.util.concurrent.CompletionException:%20org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannel$AnnotatedConnectException:%20Connection%20refused:%20/0.0.0.0:8081%20%20%20%20%20%20%20%20%20at%20java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown%20Source)%20%20%20%20%20%20%20%20%20at%20java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown%20Source)%20%20%20%20%20%20%20%20%20at%20java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(Unknown%20Source)%20%20%20%20%20%20%20%20%20...%2019%20more%20Caused%20by:%20org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannel$AnnotatedConnectException:%20Connection%20refused:%20/0.0.0.0:8081%20%20%20%20%20%20%20Caused%20by:%20java.net.ConnectException:%20Connection%20refused%20%20%20%20%20%20%20%20%20at%20java.base/sun.nio.ch.SocketChannelImpl.checkConnect(Native%20Method)%20%20%20%20%20%20%20%20%20at%20java.base/sun.nio.ch.SocketChannelImpl.finishConnect(Unknown%20Source)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:337)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20at%20org.apache.flink.shaded.netty4.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)%20%20%20%20%20%20%20%20%20at%20java.base/java.lang.Thread.run(Unknown%20Source)

0 Answers0