Thanks Michelle, that helps to clarify the reason to prefer Deployments over StatefulSets when using PDs.
On Tue, Mar 20, 2018 at 2:34 PM, 'Michelle Au' via Kubernetes user discussion and Q&A <[email protected]> wrote: > Hi Tyler, > > StatefulSets will also give you a stable network identity, if you need > that. Since GCE PDs can only be mounted in write mode by one node, you > should only have one pod referencing it. It is easy to misconfigure > Deployments to end up in scenarios with multiple pods referencing the same > GCE PD (see discussion https://github.com/kubernetes/kubernetes/issues/ > 48968#issuecomment-315490408), which will fail. For that reason, > StatefulSets is also recommended to avoid the multi-pod scenario. > > Thanks, > Michelle > > > On Tue, Mar 20, 2018 at 10:35 AM Tyler Johnson < > [email protected]> wrote: > >> I've seen documentation, blog posts, and stackoverflow responses >> indicating two different solutions for persisting data across pod restarts. >> >> In one solution, it's a volume mounted as persistent volume claim within >> a Deployment. [3] >> >> In the other, the persistent volume claim is mounted within a StatefulSet. >> >> The official documentation clearly indicates Deployments for stateless >> [1] applications and StatefulSets for stateful [2] applications. >> >> The question is, does the Deployment as stateful application set up work >> even though the documentation appears to indicate otherwise? Is there a >> significant difference between the two options? >> And does it make sense to use the StatefulSet for one pod just to set up >> persistence? The Kubernetes documentation [4] describes an unrelated goal >> for StatefulSets, indicating that they "manage the deployment and scaling >> of a set of Pods >> <https://kubernetes.io/docs/concepts/workloads/pods/pod-overview/>, and >> provides guarantees about the ordering and uniqueness of these Pods." >> >> [1] https://cloud.google.com/kubernetes-engine/docs/how-to/stateless-apps >> [2] https://cloud.google.com/kubernetes-engine/docs/how-to/stateful-apps >> [3] https://devopscube.com/persistent-volume-google-kubernetes-engine/ >> [4] https://kubernetes.io/docs/concepts/workloads/ >> controllers/statefulset/ >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Kubernetes user discussion and Q&A" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/kubernetes-users. >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "Kubernetes user discussion and Q&A" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/kubernetes-users/2jG8nr-WA3A/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/kubernetes-users. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/kubernetes-users. For more options, visit https://groups.google.com/d/optout.
