|
| 1 | += Pod Disruption Budgets (PDB) |
| 2 | + |
| 3 | +Pod disruption budgets allow users to configure how many voluntary disruptions (pod restarts) an application can tolerate if all pods are healthy. |
| 4 | + |
| 5 | +While pod disruption budgets allow users to ensure that highly available applications run smoothly on Kubernetes, some aspects of PDBs tend to impact operation of the cluster itself. |
| 6 | + |
| 7 | +The VSHN Managed OpenShift documentation on https://docs.appuio.ch/managed-openshift/workload/poddisruptionbudgets.html[pod disruption budgets^] also applies to {product}. |
| 8 | + |
| 9 | +The rest of this document discusses deviations from the VSHN Managed OpenShift documentation for {product}. |
| 10 | + |
| 11 | +== Impact on Maintenance |
| 12 | + |
| 13 | +In contrast to a dedicated VSHN Managed OpenShift cluster, {product} uses "node force drain" for all customer workloads in order to minimize impact of badly configured PDBs on maintenance of the shared platform. |
| 14 | + |
| 15 | +The node force drain on {product} is configured with a grace period of 7 minutes for each node. |
| 16 | +Any pods which weren't evicted from the node after the grace period are deleted with an API call that's equivalent to `kubectl delete pod`. |
| 17 | +This API call ignores PDBs, but respects the pod's termination policies, such as `spec.terminationGracePeriodSeconds`. |
| 18 | + |
| 19 | +There's a second grace period of 5 minutes for pods that are deleted during the force drain. |
| 20 | +Pods which get deleted but don't terminate within this second grace period are deleted with an API call that's equivalent to `kubectl delete pod --now`. |
| 21 | +This API call ignores PDBs and the pod's termination policies. |
| 22 | + |
| 23 | +== VSHN recommended practices for user-defined PDBs |
| 24 | + |
| 25 | +The practices documented in the [VSHN Managed OpenShift documentation] also apply for {product}. |
| 26 | +While PDBs can't fully block node drains on {product}, we still recommend that you try to define well-behaved PDBs. |
| 27 | + |
| 28 | +The practices can be summarized as follows: |
| 29 | + |
| 30 | +* Check PDBs defined in Helm charts, especially when deploying a single replica instance of an application with Helm |
| 31 | +* When creating PDBs by hand, prefer `spec.maxUnavailable` with a value greater than 0 over `spec.minAvailable`. |
| 32 | ++ |
| 33 | +IMPORTANT: Never create a PDB with `spec.maxUnavailable=0` or with `spec.minAvailable` equal to `spec.replicas` of the deployment targeted by the PDB. |
| 34 | +* Always set `spec.unhealthyPodEvictionPolicy=AlwaysAllow` for test and development environments. |
| 35 | +This ensures that pods in `CrashLoopBackOff` don't block node drains. |
| 36 | + |
| 37 | +== References |
| 38 | + |
| 39 | +* https://docs.appuio.ch/managed-openshift/workload/poddisruptionbudgets.html[VSHN Managed OpenShift documentation on PDBs] |
| 40 | +* https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#pod-disruption-budgets[Kubernetes pod disruption budgets] |
| 41 | +* https://kubernetes.io/docs/tasks/run-application/configure-pdb[Specifying a Disruption Budget for your Application] |
0 commit comments