-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding source code for blog post "Get Running With Flink on Kubernete…
…s" (#34)
- Loading branch information
1 parent
37e287d
commit 15d51a5
Showing
23 changed files
with
1,590 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Get Running With Flink on Kubernetes | ||
|
||
An extensive example showing how to run Flink on Kubernetes. | ||
|
||
Touching on a range of topics such as installation and set-up, creating container images for your own Flink jobs, fault tolerance and high availability, savepoint management, observability, and more. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
################################################################################ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
################################################################################ | ||
|
||
apiVersion: flink.apache.org/v1beta1 | ||
kind: FlinkDeployment | ||
metadata: | ||
name: basic-example | ||
spec: | ||
image: flink:1.20-java17 | ||
flinkVersion: v1_20 | ||
flinkConfiguration: | ||
taskmanager.numberOfTaskSlots: "2" | ||
serviceAccount: flink | ||
jobManager: | ||
resource: | ||
memory: "2048m" | ||
cpu: 1 | ||
taskManager: | ||
resource: | ||
memory: "2048m" | ||
cpu: 1 | ||
job: | ||
jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar | ||
parallelism: 2 | ||
upgradeMode: stateless | ||
ingress: | ||
template: "localhost/{{name}}(/|$)(.*)" | ||
className: "nginx" | ||
annotations: | ||
nginx.ingress.kubernetes.io/rewrite-target: "/$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
################################################################################ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
################################################################################ | ||
|
||
apiVersion: flink.apache.org/v1beta1 | ||
kind: FlinkDeployment | ||
metadata: | ||
name: custom-job-ha | ||
spec: | ||
image: decodable-examples/hello-world-job:1.0 | ||
flinkVersion: v1_20 | ||
flinkConfiguration: | ||
taskmanager.numberOfTaskSlots: "2" | ||
|
||
s3.access.key: minio | ||
s3.secret.key: minio123 | ||
s3.endpoint: http://minio-service.default.svc.cluster.local:9000 | ||
s3.path.style.access: "true" | ||
s3.entropy.key: _entropy_ | ||
s3.entropy.length: "4" | ||
|
||
execution.checkpointing.interval: "5000" | ||
|
||
state.backend: rocksdb | ||
state.backend.incremental: "true" | ||
state.checkpoints.dir: s3://flink-data/_entropy_/checkpoints | ||
state.savepoints.dir: s3://flink-data/savepoints | ||
|
||
high-availability.type: kubernetes | ||
high-availability.storageDir: s3://flink-data/ha | ||
serviceAccount: flink | ||
jobManager: | ||
resource: | ||
memory: "2048m" | ||
cpu: 1 | ||
taskManager: | ||
resource: | ||
memory: "2048m" | ||
cpu: 1 | ||
podTemplate: | ||
spec: | ||
containers: | ||
- name: flink-main-container | ||
env: | ||
- name: ENABLE_BUILT_IN_PLUGINS | ||
value: "flink-s3-fs-presto-1.20.0.jar" | ||
job: | ||
jarURI: local:///opt/flink-jobs/hello-world-job-1.0.jar | ||
parallelism: 2 | ||
upgradeMode: savepoint | ||
state: running | ||
ingress: | ||
template: "localhost/{{name}}(/|$)(.*)" | ||
className: "nginx" | ||
annotations: | ||
nginx.ingress.kubernetes.io/rewrite-target: "/$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
################################################################################ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
################################################################################ | ||
|
||
apiVersion: flink.apache.org/v1beta1 | ||
kind: FlinkDeployment | ||
metadata: | ||
name: custom-job-s3 | ||
spec: | ||
image: decodable-examples/hello-world-job:1.0 | ||
flinkVersion: v1_20 | ||
flinkConfiguration: | ||
taskmanager.numberOfTaskSlots: "2" | ||
|
||
s3.access.key: minio | ||
s3.secret.key: minio123 | ||
s3.endpoint: http://minio-service.default.svc.cluster.local:9000 | ||
s3.path.style.access: "true" | ||
s3.entropy.key: _entropy_ | ||
s3.entropy.length: "4" | ||
|
||
execution.checkpointing.interval: "5000" | ||
|
||
state.backend: rocksdb | ||
state.backend.incremental: "true" | ||
state.checkpoints.dir: s3://flink-data/_entropy_/checkpoints | ||
state.savepoints.dir: s3://flink-data/savepoints | ||
|
||
high-availability.type: kubernetes | ||
high-availability.storageDir: s3://flink-data/ha | ||
serviceAccount: flink | ||
jobManager: | ||
resource: | ||
memory: "2048m" | ||
cpu: 2 | ||
taskManager: | ||
resource: | ||
memory: "2048m" | ||
cpu: 2 | ||
podTemplate: | ||
spec: | ||
containers: | ||
- name: flink-main-container | ||
env: | ||
- name: ENABLE_BUILT_IN_PLUGINS | ||
value: "flink-s3-fs-presto-1.20.0.jar" | ||
job: | ||
jarURI: s3://job-files/hello-world-job-1.0.jar | ||
parallelism: 2 | ||
upgradeMode: savepoint | ||
state: running | ||
ingress: | ||
template: "localhost/{{name}}(/|$)(.*)" | ||
className: "nginx" | ||
annotations: | ||
nginx.ingress.kubernetes.io/rewrite-target: "/$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
################################################################################ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
################################################################################ | ||
|
||
apiVersion: flink.apache.org/v1beta1 | ||
kind: FlinkDeployment | ||
metadata: | ||
name: custom-job | ||
spec: | ||
image: decodable-examples/hello-world-job:1.0 | ||
flinkVersion: v1_20 | ||
flinkConfiguration: | ||
taskmanager.numberOfTaskSlots: "2" | ||
serviceAccount: flink | ||
jobManager: | ||
resource: | ||
memory: "2048m" | ||
cpu: 1 | ||
taskManager: | ||
resource: | ||
memory: "2048m" | ||
cpu: 1 | ||
job: | ||
jarURI: local:///opt/flink-jobs/hello-world-job-1.0.jar | ||
parallelism: 1 | ||
upgradeMode: stateless | ||
ingress: | ||
template: "localhost/{{name}}(/|$)(.*)" | ||
className: "nginx" | ||
annotations: | ||
nginx.ingress.kubernetes.io/rewrite-target: "/$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
################################################################################ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
################################################################################ | ||
|
||
apiVersion: flink.apache.org/v1beta1 | ||
kind: FlinkDeployment | ||
metadata: | ||
name: logging-job | ||
spec: | ||
image: decodable-examples/hello-world-job:1.0 | ||
flinkVersion: v1_20 | ||
flinkConfiguration: | ||
taskmanager.numberOfTaskSlots: "2" | ||
serviceAccount: flink | ||
jobManager: | ||
resource: | ||
memory: "2048m" | ||
cpu: 1 | ||
taskManager: | ||
resource: | ||
memory: "2048m" | ||
cpu: 1 | ||
job: | ||
jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar | ||
parallelism: 2 | ||
upgradeMode: stateless | ||
logConfiguration: | ||
log4j-console.properties: |+ | ||
################################################################################ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
################################################################################ | ||
# This affects logging for both user code and Flink | ||
rootLogger.level = INFO | ||
rootLogger.appenderRef.console.ref = ConsoleAppender | ||
rootLogger.appenderRef.rolling.ref = RollingFileAppender | ||
# Uncomment this if you want to _only_ change Flink's logging | ||
#logger.flink.name = org.apache.flink | ||
#logger.flink.level = INFO | ||
# The following lines keep the log level of common libraries/connectors on | ||
# log level INFO. The root logger does not override this. You have to manually | ||
# change the log levels here. | ||
logger.akka.name = akka | ||
logger.akka.level = INFO | ||
logger.kafka.name= org.apache.kafka | ||
logger.kafka.level = INFO | ||
logger.hadoop.name = org.apache.hadoop | ||
logger.hadoop.level = INFO | ||
logger.zookeeper.name = org.apache.zookeeper | ||
logger.zookeeper.level = INFO | ||
# Log all infos to the console | ||
appender.console.name = ConsoleAppender | ||
appender.console.type = CONSOLE | ||
appender.console.layout.type = JsonTemplateLayout | ||
# Log all infos in the given rolling file | ||
appender.rolling.name = RollingFileAppender | ||
appender.rolling.type = RollingFile | ||
appender.rolling.append = false | ||
appender.rolling.fileName = ${sys:log.file} | ||
appender.rolling.filePattern = ${sys:log.file}.%i | ||
appender.rolling.layout.type = PatternLayout | ||
appender.rolling.layout.pattern = %d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %-60c %x - %m%n | ||
appender.rolling.policies.type = Policies | ||
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy | ||
appender.rolling.policies.size.size=100MB | ||
appender.rolling.strategy.type = DefaultRolloverStrategy | ||
appender.rolling.strategy.max = 10 | ||
# Suppress the irrelevant (wrong) warnings from the Netty channel handler | ||
logger.netty.name = org.apache.flink.shaded.akka.org.jboss.netty.channel.DefaultChannelPipeline | ||
logger.netty.level = OFF | ||
# The monitor interval in seconds to enable log4j automatic reconfiguration | ||
# monitorInterval = 30 | ||
ingress: | ||
template: "localhost/{{name}}(/|$)(.*)" | ||
className: "nginx" | ||
annotations: | ||
nginx.ingress.kubernetes.io/rewrite-target: "/$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: flink.apache.org/v1beta1 | ||
kind: FlinkStateSnapshot | ||
metadata: | ||
name: example-savepoint | ||
spec: | ||
backoffLimit: 1 | ||
jobReference: | ||
kind: FlinkDeployment | ||
name: custom-job-ha | ||
savepoint: {} |
Oops, something went wrong.