Giter Club home page Giter Club logo

beam-go-k8s's Introduction

beam-go-k8s

Minimal working example using Beam, Go, Apache Flink, Bazel, and Kubernetes.

Minikube setup

This example is tested with minikube, but it should work for other Kubernetes distributions as well.

See hello-minikube for a tutorial.

Start minikube:

minikube start

To build container images from this repository and run them in the minikube, set up a local registry:

minikube addons enable registry

To get a local registry working, I typically follow minikube's instructions for MacOS, even though I run minikube on Ubuntu Linux:

docker run --rm -it --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:$(minikube ip):5000"

Option 1: Run a self-contained job (go binary + Flink/Beam Job Server)

bazel run //:example-pipeline.apply

Inspect the logs in your terminal:

kubectl logs --follow job/example-pipeline

You should see output like this at the bottom:

2022/05/21 05:24:35 got output:
Appear: 1
Bedlam: 3
British: 5
Could: 2
Cunning: 1
Detested: 1
Did: 4
Doth: 3
Draw: 4
Drum: 1
During: 1
Edgar: 10
Exeunt: 33
Fear: 1
Filial: 1
...

Option 2: Run local binary using a job server in a cluster

TODO: NOT WORKING YET

bazel run //:beam-flink-job-server.apply
bazel run //:beam-flink-job-server-service.apply

Rune kubefwd in a terminal:

sudo -E <PATH_TO_KUBEFWD> services \
  --kubeconfig <PATH_TO_HOME>/.kube/config \
  --namespace kubernetes-dashboard \
  --namespace default \
  --namespace kube-system

fails:

bazel run :beam-go-k8s -- \
  --runner flink \
  --endpoint beam-flink-job-server.default:8099 \
  --output /tmp/output-flink.txt  \
  --environment_type LOOPBACK

Option 3: Run using Kubernetes operator

TODO: NOT WORKING YET

Set up the Apace Flink Kubernetes operator

I would like to figure out how to use github.com/apache/flink-kubernetes-operator to run jobs.

bazel run //:cert-manager.apply

Install the operator:

helm repo add flink-operator-repo https://downloads.apache.org/flink/flink-kubernetes-operator-0.1.0/
helm install flink-kubernetes-operator flink-operator-repo/flink-kubernetes-operator

(TODO: Install this with bazel commands to avoid needing to install helm locally.)

TODO: Run job using Kubernetes operator

beam-go-k8s's People

Contributors

gonzojive avatar

Watchers

 avatar  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.