Skip to content

Commit 5a091fa

Browse files
author
Marc Rooding
authored
Merge pull request #7 from ing-bank/kubernetes-readme
Kubernetes readme
2 parents 6156cf8 + 92728ee commit 5a091fa

File tree

1 file changed

+70
-2
lines changed

1 file changed

+70
-2
lines changed

README.md

+70-2
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,82 @@ Build the Docker container:
4141

4242
`go test`
4343

44-
### Test with coverage
44+
Or with coverage:
4545

4646
`go test -coverprofile=cover.out && go tool cover`
4747

48-
# Docker image
48+
# Docker
4949

5050
A docker image for this repo is available from the docker hub: `nielsdenissen/flink-deployer`
5151

52+
# Kubernetes
53+
54+
When running in Kubernetes (or Openshift), you'll have to deploy the container to the cluster. A reason for this is Flink will try to reroute you to the internal Kubernetes address of the cluster, which doesn't resolve from outside. Besides that it'll give you the necessary access to the stored savepoints when you're using persistent volumes to store those.
55+
56+
Here's an example of how such a kubernetes yaml could look like:
57+
58+
```yaml
59+
apiVersion: v1
60+
kind: Template
61+
objects:
62+
- apiVersion: v1
63+
kind: Pod
64+
metadata:
65+
generateName: "flink-${FLINK_JOB_ID}-deployer-"
66+
spec:
67+
dnsPolicy: ClusterFirst
68+
restartPolicy: OnFailure
69+
containers:
70+
- name: "flink-${FLINK_JOB_ID}-deployer"
71+
image: "nielsdenissen/flink-deployer"
72+
args:
73+
- "update"
74+
- "-job-name-base"
75+
- "$(FLINK_JOB_NAME_BASE)"
76+
- "-file-name"
77+
- "/tmp/YOUR-FLINK-JAR.jar"
78+
- "-run-args"
79+
- "-p 2 -d -c $(MAIN_CLASS_NAME)"
80+
- "-jar-args"
81+
- "--kafka.bootstrapServers $(KAFKA_BOOTSTRAPSERVERS)"
82+
- "-savepoint-dir"
83+
- "/data/flink/savepoints/$(FLINK_JOB_ID)"
84+
imagePullPolicy: Always
85+
env:
86+
- name: FLINK_JOB_NAME_BASE
87+
value: "${FLINK_JOB_NAME_BASE}"
88+
- name: JOB_MANAGER_RPC_ADDRESS
89+
value: "jobmanager"
90+
- name: JOB_MANAGER_RPC_PORT
91+
value: "8081"
92+
- name: HIGH_AVAILABILITY
93+
value: "zookeeper"
94+
- name: ZOOKEEPER_QUORUM
95+
value: "zookeeper:2181"
96+
- name: KAFKA_BOOTSTRAPSERVERS
97+
value: "kafka:9092"
98+
- name: MAIN_CLASS_NAME
99+
value: "${MAIN_CLASS_NAME}"
100+
- name: FLINK_JOB_ID
101+
value: "${FLINK_JOB_ID}"
102+
volumeMounts:
103+
- name: flink-data
104+
mountPath: "/data/flink"
105+
volumes:
106+
- name: flink-data
107+
persistentVolumeClaim:
108+
claimName: "${PVC_FLINK}"
109+
parameters:
110+
- name: FLINK_JOB_ID
111+
description: The ID to use for pod name and savepoint directory
112+
- name: FLINK_JOB_NAME_BASE
113+
description: The job name base (you can append a version number behind this base in your actual job name)
114+
- name: MAIN_CLASS_NAME
115+
description: Name of the main class to be run in the JAR
116+
- name: PVC_FLINK
117+
description: The persistent volume claim name for flink.
118+
```
119+
52120
# Copyright
53121
54122
All copyright of project flink-job-deployer are held by Marc Rooding and Niels Denissen, 2017-2018.

0 commit comments

Comments
 (0)