万国

导航

k8s install flink

1.install docker and flannel

2.get flink image
a.get flink image from internet
docker pull flink

b.get flink image from local
docker load -i flink-latest.tar

3.tag flink image
docker tag 8f08cde24fce host:5000/flink/flink:latest

4.push flink image
docker push host:5000/flink/flink:latest

5.create flink pod
kubectl create -f flink-configuration-configmap.yaml
kubectl create -f jobmanager-service.yaml
kubectl create -f jobmanager-deployment.yaml
kubectl create -f taskmanager-deployment.yaml

6.create rest service
kubectl create -f jobmanager-rest-service.yaml

or
kubectl expose service flink-jobmanager --type=NodePort --name=flink-jobmanager-service-rest

7.deploy flink app
./bin/flink run -m <public-node-ip>:<node-port> ./examples/streaming/WordCount.jar
example:
[root@ct-1 flink-1.10.0]# ./bin/flink run -m ct-1:30081 ./examples/streaming/WordCount.jar
Executing WordCount example with default input data set.
Use --input to specify file input.
Printing result to stdout. Use --output to specify output path.
Job has been submitted with JobID 5d957b5af33ba84c65184bfa122b663c
Program execution finished
Job with JobID 5d957b5af33ba84c65184bfa122b663c has finished.
Job Runtime: 685 ms

or deploy app through webui

8.delete flink pod
kubectl delete -f jobmanager-rest-service.yaml
kubectl delete -f jobmanager-deployment.yaml
kubectl delete -f taskmanager-deployment.yaml
kubectl delete -f jobmanager-service.yaml
kubectl delete -f flink-configuration-configmap.yaml

9.log
journalctl -u kubelet -n 1000|grep nci
or
less /var/log/messages

10.referrence

apache flink

flink-configuration-configmap.yaml:

rest.port: 18081

jobmanager-rest-service.yaml:

port: 18081
targetPort: 18081
nodePort: 30081

posted on 2020-03-12 20:29  万国  阅读(305)  评论(0)    收藏  举报