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

相关推荐
hughnz1 小时前
AI和自动化让油田钻工慢慢消失
大数据·人工智能
juniperhan1 小时前
Flink 系列第8篇:Flink Checkpoint 全解析(原理+流程+配置+优化)
大数据·分布式·flink
GIS数据转换器1 小时前
延凡低成本低空无人机AI巡检方案
大数据·人工智能·信息可视化·数据挖掘·无人机
七夜zippoe2 小时前
OpenClaw 子代理(Subagent)机制详解
大数据·人工智能·subagent·openclaw·子代理
http阿拉丁神猫2 小时前
kubernetes知识点汇总43-47
云原生·容器·kubernetes
财经三剑客2 小时前
长安汽车3月销量超27万辆 海外及新能源环比大幅增长
大数据·人工智能·汽车
ClouGence2 小时前
不用搭复杂系统,也能做跨地域数据迁移?
大数据·数据库·saas
xixixi777772 小时前
Token 经济引爆 AI 产业加速:从百模大战到百虾大战,谁在定义 2026 的中国 AI?
大数据·人工智能·机器学习·ai·大模型·算力·通信
张3233 小时前
Kubernetes服务发现
云原生·kubernetes
七七powerful3 小时前
K8s 工具安装文档 — Harbor + ArgoCD
容器·kubernetes·argocd