Closed tiendatiowa closed 1 year ago
It is generally not recommended to use a Deployment with a ReadWriteOnce PVC because, as you mentioned, the default Deployment strategy involves creating a new Pod before tearing down the old one, which can lead to a deadlock if the new Pod is unable to start due to the ReadWriteOnce volume being in use.
A StatefulSet, on the other hand, is designed to handle persistent storage more gracefully and is a better choice when using ReadWriteOnce volumes. It ensures that each Pod is created and terminated in a specific order, which helps to avoid the potential deadlock scenario that can occur with Deployments.
That being said, it is possible to use a Deployment with a ReadWriteOnce PVC if you are willing to accept the risks and are prepared to handle potential failures. However, it is generally recommended to use a StatefulSet instead in order to avoid these issues.
In the example you mentioned, it is possible that the use of a Deployment with a ReadWriteOnce PVC was intentional in order to illustrate a specific scenario or to demonstrate how to handle persistent storage in a Deployment. However, if the goal of the example is to provide a recommended practice for using persistent storage with Kubernetes, it may be worth considering updating the example to use a StatefulSet instead.
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle stale
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle rotten
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/reopen
/remove-lifecycle rotten
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
In the example manifest, the service is deployed as a Deployment and a ReadWriteOnce PVC. But a Deployment with a ReadWriteOnce PVC is not recommended per K8S doc:
So the question is: is the use of Deployment on purpose? Or should the example be updated to use Statefulset?