Job lifecycle management

Learn more about Flink job lifecycle management.

You can control the state of the application using the state property of the spec.job in the FlinkDeployment resource. The following application states are supported:
  • running: The job is expected to be running and processing data.
  • suspended: Data processing is temporarily suspended, with the intention of continuing later.
You can stop the Flink job by modifying the spec.job.state from running to suspended.
$ kubectl -n [*** NAMESPACE ***] patch FlinkDeployment [*** FLINK DEPLOYMENT NAME ***] \
    --type=merge \
    --patch='{"spec":{"job":{"state":"suspended"}}}'
Suspended jobs can be restarted using the same method:
$ kubectl [*** NAMESPACE ***] patch FlinkDeployment [*** FLINK DEPLOYMENT NAME ***] \
    --type=merge \
    --patch='{"spec":{"job":{"state":"running"}}}'
The following state transition scenarios exist when updating the existing Flink Deployment resource:
  • from running to running: Job upgrade operation. In practice, a suspend followed by a restore operation.
  • from running to suspended: Suspend operation to stop the application while maintaining the application state.
  • from suspended to running: Restore operation to start the application from current state using the latest spec.
  • from suspended to suspended : Deployment spec is updated, but the application is not started.
The explained state changes do not remove the FlinkDeployment resource from the cluster, the operation is simply suspended. When you no longer wish to process data using an existing FlinkDeployment resource, the following command can be used to delete the application:
kubectl -n [*** NAMESPACE ***] delete FlinkDeployment [*** FLINK DEPLOYMENT NAME ***]