I'm trying to understand containerized apps and databases and I'm trying to understand the microservice architecture using kubernetes. One thing that I couldn't get my mind convinced is the database part.
For example I have a Venues database and a Venues REST API application in a container, which also has the database inside the same container.
When the first instance crashes for some reason, kubernetes launches a second instance. Or, there may be more than one of the same service running in different instances. Or they might be connecting another DB service all together.
The thing that I couldn't understand, when the service which contains the DB crashes, the newly created container will have an empty database right? How is this handled? If replication is the case, what about memory and disk usages?
Please someone clarify this with different approaches. Or is there something previously asked here, or somewhere else, please direct me to the right direction.
Thanks in advance.