Flink K8s Operator 测试验证

basic.yaml

yaml 复制代码
apiVersion: flink.apache.org/v1beta1
kind: FlinkDeployment
metadata:
  name: basic-example
spec:
  image: 10.177.85.101:8000/flink/flink:1.16
  flinkVersion: v1_16
  flinkConfiguration:
    taskmanager.numberOfTaskSlots: "2"
  serviceAccount: flink
  jobManager:
    resource:
      memory: "2048m"
      cpu: 1
  taskManager:
    resource:
      memory: "2048m"
      cpu: 1
  job:
    jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar
    parallelism: 2
    upgradeMode: stateless

提交job:

sh 复制代码
kubectl create -f basic.yaml

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

sh 复制代码
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:

sh 复制代码
kubectl delete flinkdeployment/basic-example

二 HA and CheckPoint

basic-checkpoint-ha.yaml

sh 复制代码
apiVersion: flink.apache.org/v1beta1
kind: FlinkDeployment
metadata:
  name: basic-checkpoint-ha-example
spec:
  image: 10.177.85.101:8000/flink/flink:1.16
  flinkVersion: v1_16
  flinkConfiguration:
    taskmanager.numberOfTaskSlots: "2"
    state.savepoints.dir: file:///flink-data/savepoints
    state.checkpoints.dir: file:///flink-data/checkpoints
    high-availability: org.apache.flink.kubernetes.highavailability.KubernetesHaServicesFactory
    high-availability.storageDir: file:///flink-data/ha
  serviceAccount: flink
  jobManager:
    resource:
      memory: "2048m"
      cpu: 1
  taskManager:
    resource:
      memory: "2048m"
      cpu: 1
  podTemplate:
    spec:
      containers:
        - name: flink-main-container
          volumeMounts:
          - mountPath: /flink-data
            name: flink-volume
      volumes:
      - name: flink-volume
        hostPath:
          # directory location on host
          path: /tmp/flink
          # this field is optional
          type: Directory
  job:
    jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar
    parallelism: 2
    upgradeMode: savepoint
    state: running
    savepointTriggerNonce: 0

提交job:

sh 复制代码
kubectl create -f basic-checkpoint-ha.yaml

相关推荐
数据猿35 分钟前
【金猿CIO展】如康集团CIO 赵鋆洲:数智重塑“顶牛”——如康集团如何用大数据烹饪万亿肉食产业的未来
大数据
羊羊羊i1 小时前
使用Informer监听K8s资源
云原生·容器·kubernetes
VermiliEiz2 小时前
二进制文件部署k8s方式(5)
云原生·容器·kubernetes
用户7227868123442 小时前
Flink源码阅读:Task数据交互
flink
zxsz_com_cn3 小时前
设备预测性维护的意义 工业设备预测性维护是什么
大数据
2301_810746313 小时前
CKA冲刺40天笔记 - day24 Kubernetes Clusterrole 和 Clusterrole Binding
笔记·容器·kubernetes
samLi06203 小时前
【数据集】中国杰出青年名单数据集(1994-2024年)
大数据
成长之路5144 小时前
【数据集】分地市旅游收入数据集(2000-2024年)
大数据·旅游
大厂技术总监下海4 小时前
用户行为分析怎么做?ClickHouse + 嵌套数据结构,轻松处理复杂事件
大数据·数据结构·数据库
大厂技术总监下海4 小时前
大数据生态的“主动脉”:RocketMQ 如何无缝桥接 Flink、Spark 与业务系统?
大数据·开源·rocketmq