Git Product home page Git Product logo

beam-flink-k8s's Introduction

beam-flink-k8s

Example project for running Beam on Flink in Kubernetes based on Müller Fourier's Medium article.

Requirements

Local Deployment

Additional Requirements

Preparations

Docker service must be running:

start minikube
eval $(minikube -p minikube docker-env)
kubectl get all
EKS Deployment

Additional Requirements

Preparations

Activate AWS profile if needed:

export AWS_PROFILE=<your_profile>

Set AWS region:

export AWS_REGION=<your_region>

Set KMS key used for envelope encryption of Kubernetes secrets: (create a new customer managed KMS key if needed)

export AWS_KMS_KEY_EKS=<your_key_arn>

Launch cluster (envsubst will substitute the evironment variables in the .yaml file for you):

envsubst < flink_cluster/eks-flink-cluster.yaml | eksctl create cluster -f -

Check that your nodes have been created:

kubectl get nodes

Update the kubeconfig file to interact with you cluster:

aws eks update-kubeconfig --name beam-flink-eks

Spin up Flink cluster

Create configuration and servive definitions:

kubectl apply -f flink_cluster/flink-configuration-configmap.yaml
kubectl apply -f flink_cluster/jobmanager-service.yaml

Launch Jobmanager (orchestrator) and Taskmanager (worker) deployments:

kubectl apply -f flink_cluster/jobmanager-session-deployment.yaml
kubectl apply -f flink_cluster/taskmanager-session-deployment.yaml

Run Beam job

Check that jobmanager and taskmanager deployments & pods are ready:

kubectl get all

Init env variable to point to the endpoint of the jobmanager

export JOBMANAGER_ENDPOINT=$(k get pods -l app=flink,component=jobmanager -o jsonpath='{.items[].status.podIP}')

Submit job (envsubst will substitute the JOBMANGER_ENDPOINT for you):

envsubst < beam_jobs/word_count/beam_wordcount_py.yaml | kubectl apply -f -

Monitor jobs by port forwarding and opening localhost:8081 for Flink dashboard

kubectl port-forward <service/flink-jobmanager> 8081:8081

Delete job (if needed):

kubectl delete -f beam_jobs/word_count/beam_wordcount_py.yaml

Shutdown Cluster

kubectl delete -f flink_cluster/taskmanager-session-deployment.yaml
kubectl delete -f flink_cluster/jobmanager-session-deployment.yaml
kubectl delete -f flink_cluster/jobmanager-service.yaml
kubectl delete -f flink_cluster/flink-configuration-configmap.yaml
Local Deployment
minikube stop
EKS Deployment
eksctl delete cluster --name beam-flink-eks

beam-flink-k8s's People

Contributors

n0rritt avatar

Stargazers

Joonhee Han (Sinclair) avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.