Deploying Flink applications

Learn more about how to deploy Flink applications.

  1. Define the spec.job in the FlinkDeployment configuration file to create an application deployment as shown in the following example:
    apiVersion: flink.apache.org/v1beta1
    kind: FlinkDeployment
    metadata:
      name: flink-kubernetes-tutorial
    spec:
      image: [***REGISTRY HOST***]:[***PORT***]/[***PROJECT***]/flink-kubernetes-tutorial:latest
      flinkVersion: v1_18
      flinkConfiguration:
        taskmanager.numberOfTaskSlots: "4"
      serviceAccount: flink
      mode: native
      jobManager:
        resource:
          memory: "2048m"
          cpu: 1
      taskManager:
        resource:
          memory: "2048m"
          cpu: 1
      job:
        args: ["--rowsPerSec", "10"]
        jarURI: local:///opt/flink/usrlib/flink-kubernetes-tutorial.jar
        parallelism: 4
        state: running
        upgradeMode: stateless
    The following properties are required for the application deployment:
    Property Description
    jarURI URI of the Flink job JAR file in the Docker image.
    parallelism Parallelism of the Flink job.
    state State of the Flink job that can be running or suspended.
    upgradeMode Upgrade mode of the Flink job that can be one of the following:
    • stateless: No state will be saved
    • last-state: Uses Flink high availability metadata to resume jobs
    • savepoint: Uses Flink savepoints to cancel and resume jobs
  2. Submit the YAML file to run the application when configuring the FlinkDeployment resource is complete:
    kubectl apply -f your-deployment.yaml