DEV Community

Discussion on: Data Persistence in Kubernetes | Kubernetes Volumes simply explained

Collapse
 
techworld_with_nana profile image
TechWorld with Nana

Yes, that's exactly right. You usually deploy DB applications with StatefulSet components and use volumes there. However the exceptions can be for example if you are just using a configuration file or a secret file for your application. Then you have a deployment with configMap or secret volumes. Or you can also have just 1 pod DB, with no replicas. In that case I would use deployment and not StatefulSet, because you need statefulSet if you need more than 1 pod replica of the DB.

Collapse
 
yourtechbud profile image
Noorain Panjwani

Interesting. I use statefulsets even if there's a single replica 🤣. But using a deployment makes sense.

As for configmaps and secrets, Never had to deal with volumes directly. I didn't know you can store these on volumes. I was under the impression kubernetes stores them in etcd or something. We just need to mount them as volumes or env variables