Flink-kubernetes-operator
A Kubernetes operator for Apache Flink(https://github.com/apache/flink-kubernetes-operator), it allows users to manage Flink applications and their lifecycle through native k8s tooling like kubectl.
vela addon enable flink-kubernetes-operator
vela addon disable flink-kubernetes-operator
Since this addon dependents fluxcd and cert-manager addon, so will enable them automatically. Check the status of them:
$ vela ls -n vela-systemAPP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIMEaddon-cert-manager cert-manager helm running healthy Fetch repository successfully, Create helm release 2022-06-16 11:50:19 +0800 CSTsuccessfullyaddon-flink-kubernetes-operator flink-namespace raw running healthy 2022-06-16 11:50:20 +0800 CST└─ flink-operator helm running healthy Fetch repository successfully, Create helm release 2022-06-16 11:50:20 +0800 CSTsuccessfullyaddon-fluxcd flux-system-namespace raw running healthy 2022-06-16 11:47:07 +0800 CST└─ fluxcd-resources k8s-objects running healthy 2022-06-16 11:47:07 +0800 CST
Show the component type flink-cluster, so we know how to use it in one application. As a Flink user, you can choose the parameter to set for your Flink cluster
vela show flink-cluster# Specification# Specification+--------------+------------------------------------------------------------------------------------------------------+--------+----------+---------+| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |+--------------+------------------------------------------------------------------------------------------------------+--------+----------+---------+| name | Specify the flink cluster name. | string | true | || namespace | Specify the namespace for flink cluster to install. | string | true | || nots | Specify the taskmanager.numberOfTaskSlots, e.g "2". | string | true | || flinkVersion | Specify the flink cluster version, e.g "v1_14". | string | true | || image | Specify the image for flink cluster to run, e.g "flink:latest". | string | true | || jarURI | Specify the uri for the jar of the flink cluster job, e.g | string | true | || | "local:///opt/flink/examples/streaming/StateMachineExample.jar". | | | || parallelism | Specify the parallelism of the flink cluster job, e.g 2. | int | true | || upgradeMode | Specify the upgradeMode of the flink cluster job, e.g "stateless". | string | true | || replicas | Specify the replicas of the flink cluster jobManager, e.g 1. | int | true | || jmcpu | Specify the cpu of the flink cluster jobManager, e.g 1. | int | true | || jmmem | Specify the memory of the flink cluster jobManager, e.g "1024m". | string | true | || tmcpu | Specify the cpu of the flink cluster taskManager, e.g 1. | int | true | || tmmem | Specify the memory of the flink cluster taskManager, e.g "1024m". | string | true | |+--------------+------------------------------------------------------------------------------------------------------+--------+----------+---------+
First please make sure your cluster already exists namespace flink-cluster.
Then deploy the application:
cat <<EOF | vela up -f -apiVersion: core.oam.dev/v1beta1kind: Applicationmetadata:name: flink-app-v1namespace: vela-systemspec:components:- name: my-flink-componenttype: flink-clusterproperties:name: my-flink-clusternamespace: flink-clusternots: '2'flinkVersion: v1_14image: flink:latestjarURI: local:///opt/flink/examples/streaming/StateMachineExample.jarparallelism: 2upgradeMode: statelessreplicas: 1jmcpu: 1jmmem: 1024mtmcpu: 1tmmem: 1024m
Check the flink cluster
vela ls -n vela-system | grep appflink-app-v1 my-flink-component flink-cluster running healthy 2022-07-30 18:53:34 +0800 CST
Accesss the flink cluster by website using http://localhost:8888
kubectl get svc -n flink-cluster | grep restmy-flink-cluster-rest ClusterIP 192.168.149.175 <none> 8081/TCP 17mkubectl port-forward service/my-flink-cluster-rest 8888:8081 -n flink-clusterForwarding from 127.0.0.1:8888 -> 8081
Last updated on Feb 9, 2023 by dependabot[bot]