Docs Home
Viewing docs for
Self-ManagedNot available for BYOC

Deployment Templates

On this page

Deployment templates are specified as part of Deployment under spec.template and configure the Apache Flink® job to execute, including Flink cluster-level configuration as well as Flink job-specific configuration.

Overview

The relationship between the overall Deployment specification and its Deployment template is as follows:

  • The Deployment template specifies which Apache Flink® job is executed and how to execute it, including its configuration.
  • The Deployment specification defines how job instances are managed over time, for instance how to perform upgrades or which Savepoint to restore from.

On a high-level, each Deployment template consists of two parts:

  • metadata Optional annotations used to provide additional configuration options, used to enable additional features.
  • spec The spec specifies which Flink job to execute and how to configure it.

The main part of a Deployment template is its spec which is described in the following sections. At the end of this page you will find a full example.

Application Mode vs. Session Mode

The Deployment template specifies both Flink cluster-level configuration as well as Flink job-specific configuration.

In application mode, the Deployment will be executed in a separate Flink cluster and all template attributes are available for configuration.

In session mode, the Deployment will be executed in a shared Flink cluster and some template attribute have to be omitted. The cluster-level configuration happens as part of the SessionCluster resource referenced by the Deployment. Therefore, cluster-level configuration must be ommitted from the Deployment template.

The following table summarizes the available attributes and whether they can be specified in the respective Deployment mode.

Application vs. Session Mode

AttributeSee AlsoApplication ModeSession Mode
Metadata (template.metadata)
annotations["flink.queryable-state.enabled"]Flink Configuration!
annotations["flink.security.ssl.enabled"]Flink Configuration!
Spec (template.spec)
artifact["kind"="jar"]Artifacts
artifact["kind"="sqlscript"]Artifacts
flinkConfigurationFlink Configuration
parallelismScaling Deployments
numberOfTaskManagersScaling Deployments!
resourcesScaling Deployments!
loggingLogging!
kubernetesKubernetes Pod Templates!
  • ✓ indicates that the attribute can be configured as part of the Deployment Template.
  • ! indicates that the attribute cannot be configured as part of the Deployment Template. In this case, the attribute affects the Flink cluster and should be configured as part of the SessionCluster referenced by the Deployment.

Full Example

YAML
1kind: Deployment
2apiVersion: v1
3metadata:
4  name: top-speed-windowing-example
5  displayName: TopSpeedWindowing Example
6  labels:
7    env: testing
8spec:
9  state: RUNNING
10  deploymentTargetName: default
11  restoreStrategy:
12    kind: LATEST_STATE
13  upgradeStrategy:
14    kind:  STATEFUL
15  maxSavepointCreationAttempts: 4
16  maxJobCreationAttempts: 4
17  jobFailureExpirationTime: 0
18  template:
19    metadata:
20      annotations:
21        flink.queryable-state.enabled: 'false'
22        flink.security.ssl.enabled: 'false'
23    spec:
24      artifact:
25        kind: jar
26        jarUri: https://repo1.maven.org/maven2/org/apache/flink/flink-examples-streaming_2.12/{flinkRelease}/flink-examples-streaming_2.12-{flinkRelease}-TopSpeedWindowing.jar
27        additionalDependencies:
28        - s3://mybucket/some_additional_library.jar
29        - s3://mybucket/some_additional_resources
30        mainArgs: --windowSize 10 --windowUnit minutes
31        entryClass: org.apache.flink.streaming.examples.windowing.TopSpeedWindowing
32        flinkVersion: {flinkVersion}
33        flinkImageRegistry: registry.ververica.com/v{shortVersion}
34        flinkImageRepository: flink
35        flinkImageTag: {ververicaFlinkRelease}-scala_2.12
36      flinkConfiguration:
37        execution.checkpointing.externalized-checkpoint-retention: RETAIN_ON_CANCELLATION
38        execution.checkpointing.interval: 10s
39        high-availability: vvp-kubernetes
40        state.backend: filesystem
41      parallelism: 2
42      numberOfTaskManagers: 2
43      resources:
44        jobmanager:
45          cpu: 1
46          memory: 1g
47        taskmanager:
48          cpu: 1.0
49          memory: 2g
50      logging:
51        loggingProfile: default
52        log4jLoggers:
53          "": INFO
54          org.apache.flink.streaming.examples: DEBUG
55      kubernetes:
56        pods:
57          envVars:
58          - name: KEY
59            value: VALUE
Was this helpful?