Flink K8S提交

1.创建namespace
kubectl create namespace flink-session-cluster-test
 
2.创建账号
kubectl create serviceaccount flink-test -n flink-session-cluster-test
 
3.创建角色并绑定到namespace
kubectl create clusterrolebinding flink-role-binding-flink --clusterrole=edit --serviceaccount=flink-session-cluster-test:flink-test
 
4.以上述账号提交作业到相应的namespace
flink 1.13
4.1首先创建flink cluste
./bin/kubernetes-session.sh -Dkubernetes.cluster-id=my-first-flink-cluster -Dkubernetes.namespace=flink-session-cluster-test -Dkubernetes.service-account=flink-test -Dkubernetes.rest-service.exposed.type=NodePort
-Dkubernetes.container.image=flink:1.13.1-scala_2.11-java8 -Dkubernetes.container.image.pull-policy=Always
4.2提交作业到上面的cluster
./bin/flink run -d --target kubernetes-session -Dkubernetes.namespace=flink-session-cluster-test -Dkubernetes.cluster-id=my-first-flink-cluster -c SentenceSender ./examples/streaming/FlinkSample.jar
 
5.附录
5.1 服务暴露的方式指定为NodePort 不然无法连接
kubernetes.service.exposed.type=NodePort
kubernetes.rest-service.exposed.type=NodePort
5.2 可以登陆到pod中去看相关的环境
kubectl exec -it --namespace flink-session-cluster-test pod/example-c675c658c-qqz8x -- bash
posted @ 2021-11-19 10:04  boiledwater  阅读(618)  评论(0编辑  收藏  举报