Skip to content

Murtagy/sidecar-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repo serves like as an example of two http services written in Python served together as a single pod.

Note: this is a simplistic example. On production you might want to:

  • define probes;
  • assure sidecar fully starts before main app (e.g. move sidecar into initContainers section) ;
  • think through what should happen if any of the apps is not healthy;
  • etc...

How to follow the example:

  1. Install docker (follow the official guide)
  2. Install minikube (follow official guide) If you run into any issues I recommend installing minikube' dashboard for ease of debugging and overview.
  3. Make sure you are not targetting production with kubectl (e.g. run kubectx)
  4. Run local image registry
  • https://minikube.sigs.k8s.io/docs/handbook/registry/#docker-on-macos
  • run minikube addons enable registry
  • run minikube ip
  • run export MINIKUBE_IP=<> and put ip from previous step there. I do this explicitly because output of my command had a section about running on M1 and thus spoiling the official guide.
  • run docker run --rm -it --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:${MINIKUBE_IP}:5000"
  1. Build image
  • run docker build -t sidedemo .
  • run docker tag sidedemo localhost:5000/sidedemo
  • run docker push docker tag sidedemo localhost:5000/sidedemo
  1. Start the service
  • run kubectl apply -f my_demo.yaml
  • run kubectl port-forward sidecar-python-demo 8080:80

Now you should be able to open localhost:80. Good luck, sailor!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published