Skip to content

cprey/fastapi-kafka-stuff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python One

That one tutorial in python that shows an interaction with Kafka.

Let's install and run this bad boy

🚨 A gotcha is you must specify imagePullPolicy: Never or this will not obey the local dockerfile repo.

  1. Set up minkube to use a local Docker

    Lets set up minikube to use it's local docker image repo. You will need to do this for every shell.

    eval $(minikube -p minikube docker-env)

    Now when you type docker image ls you will see the contents of minikube's local docker. This allows you to use images from your local system instead of ECR or Dockerhub.

  2. install the Helm chart for Kafka

  3. run docker build to add image to local minikube docker inventory

    • docker build -t python-one .
  4. install the python-one.yaml and see what's there

    • kubectl apply -f python-one.yaml
    • kubectl get all
  5. install the ingress

    • kubectl apply -f ingress.yaml
  6. test it out

    • curl $(minikube ip)/
    • curl $(minikube ip)/docs
  7. fire off a call to producer

    • kubectl exec -it python-one -- python app/producer.py
  8. use a browser to look at changes

    • http://minikube ip/state
    • http://minikube ip/docs - OpenAPI docs
    • http://minikube ip/ - "Classic" Hello, world
  9. fire off an update to kafka using the app

    • kubectl exec -it python-one python app/producer.py
    • check for the update in the browser using the state http://minikube ip/state
  10. show logs

    • kubectl logs -f python-one # -f is follow - CTRL+c to stop
    • kubectl logs -f kafka-0

make changes to app and rebuild

  1. docker build -t one .

  2. kubectl delete -f python-one.yaml

  3. kubectl apply -f python-one.yaml

clean up

  1. Building the images is gonna leave a bunch of garbage laying around - docker system prune --volumes cleans it up

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors