"No one is harder on a talented person than the person themselves" - Linda Wilkinson ; "Trust your guts and don't follow the herd" ; "Validate direction not destination" ;

July 23, 2020

Day #337 - Lessons Learnt in Playing with Docker, Kubernetes, VOLUME in Docker vs VOLUME Kubernetes

Tip #1 - To make flask API multithreaded, Add the option threaded in app.run()

app.run(host= '0.0.0.0',port=4321,threaded=True)

Tip #2 - To run a flask API in Docker, which involves file operations we can specify VOLUME

VOLUME inside docker file definition - Basically with VOLUME command you get performance without externally mounting any volumes.
VOLUME ['/datadir']
Some good example use cases:
  • logs
  • temp folders
Ref - Stackoverflow Answer

Tip #3 - Alternate option to #2 - Provide volume while running docker

docker run -p 8080:8080 Demo-App --volume=/Users/tmp:/app Demo-App

Tip #4. Specify Volume - emptyDir inside Kubernetes for temporary data

Use emptyDir Option. emptyDir volume should NOT be used for persisting data. Data erased when pod is removed.

Happy Learning!!!

No comments: