一 Submitting a Flink job

basic.yaml

apiVersion: flink.apache.org/v1beta1kind: FlinkDeploymentmetadata:name: basic-examplespec:image: 10.177.85.101:8000/flink/flink:1.16flinkVersion: v1_16flinkConfiguration:taskmanager.numberOfTaskSlots: "2"serviceAccount: flinkjobManager:resource:memory: "2048m"cpu: 1taskManager:resource:memory: "2048m"cpu: 1job:jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jarparallelism: 2upgradeMode: stateless

提交job:

kubectl create -f basic.yaml

To expose the Flink Dashboard you may add a port-forward rule or look the ingress configuration options:

kubectl port-forward --address 0.0.0.0 svc/basic-example-rest 8081 -n flink-operator

Now the Flink Dashboard is accessible at ip:8081.

删除job:

kubectl delete flinkdeployment/basic-example

二 HA and CheckPoint

basic-checkpoint-ha.yaml

apiVersion: flink.apache.org/v1beta1kind: FlinkDeploymentmetadata:name: basic-checkpoint-ha-examplespec:image: 10.177.85.101:8000/flink/flink:1.16flinkVersion: v1_16flinkConfiguration:taskmanager.numberOfTaskSlots: "2"state.savepoints.dir: file:///flink-data/savepointsstate.checkpoints.dir: file:///flink-data/checkpointshigh-availability: org.apache.flink.kubernetes.highavailability.KubernetesHaServicesFactoryhigh-availability.storageDir: file:///flink-data/haserviceAccount: flinkjobManager:resource:memory: "2048m"cpu: 1taskManager:resource:memory: "2048m"cpu: 1podTemplate:spec:containers:- name: flink-main-containervolumeMounts:- mountPath: /flink-dataname: flink-volumevolumes:- name: flink-volumehostPath:# directory location on hostpath: /tmp/flink# this field is optionaltype: Directoryjob:jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jarparallelism: 2upgradeMode: savepointstate: runningsavepointTriggerNonce: 0

提交job:

kubectl create -f basic-checkpoint-ha.yaml