[FLINK-16685] Add a k8s example for the Python SDK #62
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a Kubernetes example
This example demonstrates how to deploy a stateful function application
written in Python to Kubernetes.
Prerequisites
Overview
This examples create a stateful function application,
that consumes
LoginEvents from aloginsKafka topic,and produces
seencount per user, into theseenKafka topic.The main example components contains:
Setup
Create Kafka Topics:
This example consumes
LoginEvents from theloginstopic, and producesSeenCounttothe
seentopicupdate module.yaml
Make sure that your
module.yamlingress/and egress sections point to yourKafka cluster.
Build the Docker images and the k8s resource yamls.
This examples creates two different Docker images, one for the
Pythonremoteworker (
k8s-demo-python-worker) and one for the statefun cluster (k8s-demo-statefun).If you have a remote docker registry (i.e.
gcr.io/<project-name>) make sureto update resources/values.yaml relevant
image:sections.Modify resources/values.yaml and set the value of
checkpoint.directoryto a filesystem / object store. For example
Assuming the all prerequisites where completed run:
build-example.shThis should create the Docker images and generate a
k8s-demo.yamlfile.Deploy
kubectl create -f k8s-demo.yamlGenerate events
Run:
This would generate 1,000 login events into the
loginstopic