Hello guys, I need some help real quick. I am tryi...
# kubernetes
a
Hello guys, I need some help real quick. I am trying to deploy two separate containers to a cluster, a postgres and a simple flask app. I would like to have an sql dump be read and written to the postgres server when ready and then have this simple flask app read the data that was written to the database. The bottleneck for me is how to successfully have this sql dump on the server. Any helps here will be appreciated
a
Few different ways you could approach this. You could (this is a basic example) use a
PostStart
hook on the PostgreSQL container in the Pod that waits for Postgres to become available, then loads the SQL dump. Then have the Flask container
readiness
check wait for the data to be imported before allowing request through (not the best way) Other (simple) way you could do it is use 2 Pods (1 for Postgres, 1 for Flask) and use an
initContainer
in the Flask Pod that waits for Postgres to become available, then loads the SQL dump in it's entirety before Flask starts. (there are various different/better ways to do it, but those might be sufficient?)
a
Thanks so much, I used the
scripts
approach to solve, i also had to run the different applications in separate pods