https://platformengineering.org logo
#kubernetes
Title
# kubernetes
a

Anthony Ezeabasili

03/14/2023, 2:50 PM
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

Andrew Kirkpatrick

03/14/2023, 3:09 PM
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

Anthony Ezeabasili

03/15/2023, 7:40 PM
Thanks so much, I used the
scripts
approach to solve, i also had to run the different applications in separate pods
25 Views