Flink Forward 2025 Barcelona: The Future of AI is Real-Time
I need to configure some Kubernetes resources (e.g., labels, environment variables, volumes, init containers, sidecar containers, etc.) for my Flink pods in Ververica Platform. Could you show me some examples?
Note: This section applies to Ververica Platform 2.0 - 2.8.
Ververica Platform supports two ways to configure Kubernetes resources for Flink pods running in Ververica Platform. See the Ververica Plaform's documentation for more details. This article focuses on examples and is complementary to the official documentation. Here is an overview of both approaches.
kind: Deployment # Ververica Platform Deployment (not the Kubernetes one)
spec:
template:
spec:
kubernetes:
pods: <KubernetesPodOptions> # (1)
jobManagerPodTemplate: <V1PodTemplateSpec> # (2)
taskManagerPodTemplate: <V1PodTemplateSpec> # (2)
The options configured via this approach apply to both jobmanager and taskmanager pods. This approach supports only annotations
, labels
, nodeSelector
, affinity
, tolerations
, imagePullSecrets
, volumeMounts
, securityContext
, and environment variables.
This approach is supported in Ververica Platform 2.4 and later. You configure jobmanager and taskmanager pods individually here. This approach provides full flexibility by exposing the complete Kubernetes V1PodTemplateSpec API and is our recommendation for Ververica Platform 2.4 and later.
Note: You can use only one of two approaches in a deployment. If you have some options configured via the simplified approach, and now need some advanced options like init containers, you will have to convert them to use the full-fledged approach.
The following sections will show you some often used examples.
Full-fledged Pod Templates (Recommended)
kind: Deployment
spec:
template:
spec:
kubernetes:
taskManagerPodTemplate: # or "jobManagerPodTemplate"
spec:
containers: # or "initContainers"
- name: flink-taskmanager # or "flink-jobmanager"
env:
- name: VAR1
value: Hello
- name: VAR2
valueFrom:
secretKeyRef: # or "configMapKeyRef"
name: mysecret
key: password
# envFrom is supported only in the full-fledged approach
envFrom: # expose all key-value pairs in a configMap
- configMapRef:
name: myconfig
Simplified Pod Options
kind: Deployment
spec:
template:
spec:
kubernetes:
pods:
envVars: # not "env" but "envVars"!
- name: VAR1
value: Hello
- name: VAR2
valueFrom:
secretKeyRef: # or "configMapKeyRef"
name: mysecret
key: password
Full-fledged Pod Templates (Recommended)
kind: Deployment
spec:
template:
spec:
kubernetes:
taskManagerPodTemplate: # or "jobManagerPodTemplate"
spec:
containers: # or "initContainers"
- name: flink-taskmanager # or "flink-jobmanager"
volumeMounts:
- name: volume-config
mountPath: /config
- name: volume-secret
mountPath: /secret
- name: volume-data
mountPath: /data
volumes:
- name: volume-config
configMap:
name: myapp-config
- name: volume-secret
secret:
secretName: userpass
- name: volume-data
persistentVolumeClaim:
claimName: myapp-data
Simplified Pod Options
kind: Deployment
spec:
template:
spec:
kubernetes:
pods:
volumeMounts:
- name: volume-secret
volume:
name: volume-secret
secret: # mount a volume from a secret
secretName: mysecret
volumeMount:
name: volume-secret
mountPath: /secret
- name: volume-config
volume:
name: volume-config
configMap: # mount a volume from a configMap
name: myapp-config
volumeMount:
name: volume-config
mountPath: /config
- name: volume-data
volume:
name: volume-data
persistentVolumeClaim: # mount a volume from a PVC
claimName: myapp-data
volumeMount:
name: volume-data
mountPath: /data
Full-fledged Pod Templates (Recommended)
kind: Deployment
spec:
template:
spec:
kubernetes:
taskManagerPodTemplate: # or "jobManagerPodTemplate"
metadata:
labels:
appverion: 1.0
region: 'europe'
annotations:
prometheus.io/port: '9249'
prometheus.io/scrape: 'true'
Simplified Pod Options
kind: Deployment
spec:
template:
spec:
kubernetes:
pods:
labels:
appverion: 1.0
region: 'europe'
annotations:
prometheus.io/port: '9249'
prometheus.io/scrape: 'true'
This example is only supported by the full-fledged pod templates. It uses an init container (image: alpine:latest
) to download myfile.txt
before taskmanager starts and make it available to taskmanager under /myapp-file
:
kind: Deployment
spec:
template:
spec:
kubernetes:
taskManagerPodTemplate: # or "jobManagerPodTemplate"
spec:
containers:
- name: flink-taskmanager # or "flink-jobmanager"
volumeMounts:
- name: myapp-file
mountPath: /myapp-file # myfile.txt is available under /myapp-file
initContainers:
- name: myapp-init
image: 'alpine:latest'
command:
- sh
- '-c'
- >-
wget -q --no-check-certificate -P /myapp-file
https://path/to/myfile.txt
volumeMounts:
- name: myapp-file
mountPath: /myapp-file
volumes:
- name: myapp-file
emptyDir: {}
This example is taken from Ververica Platform's doc and is supported only by the full-fledged pod templates. It adds an additional sidecar container named my-logging-sidecar
to both the JobManager and TaskManager pods.
kind: Deployment
spec:
template:
spec:
kubernetes:
jobManagerPodTemplate:
spec:
containers:
- name: my-logging-sidecar
image: registry.acme.org/logging:3.2.1
taskManagerPodTemplate:
spec:
containers:
- name: my-logging-sidecar
image: registry.acme.org/logging:3.2.1
This example is supported only by the full-fledged pod templates. It sets container resource requests and limits to different values:
kind: Deployment
spec:
template:
spec:
kubernetes:
taskManagerPodTemplate: # or jobManagerPodTemplate
spec:
containers:
- name: flink-taskmanager # or flink-jobmanager
resources:
requests:
cpu: 0.5
memory: 500Mi
ephemeral-storage: 2Gi
limits:
cpu: 1
memory: 1Gi
ephemeral-storage: 4Gi
- name: mysidecar
resources: # similar for sidecar containers
initContainers:
- name: myinit
resources: # similar for init containers