Skip to content

Commit 82c68dc

Browse files
committed
OSDOCS-5336: Adding PDBUnhealthyPodEvictionPolicy as tech preview feature
1 parent 8a3b460 commit 82c68dc

File tree

6 files changed

+84
-7
lines changed

6 files changed

+84
-7
lines changed

modules/nodes-cluster-enabling-features-about.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ The following Technology Preview features are enabled by this feature set:
3232
** External cloud providers. Enables support for external cloud providers for clusters on vSphere, AWS, Azure, and GCP. Support for OpenStack is GA. (`ExternalCloudProvider`)
3333
** Pod topology spread constraints. Enables the `matchLabelKeys` parameter for pod topology constraints. The parameter is list of pod label keys to select the pods over which spreading will be calculated. (`MatchLabelKeysInPodTopologySpread`)
3434
** Pod security admission enforcement. Enables restricted enforcement for pod security admission. Instead of only logging a warning, pods are rejected if they violate pod security standards. (`OpenShiftPodSecurityAdmission`)
35+
** Pod disruption budget (PDB) unhealthy pod eviction policy. Enables support for specifying how unhealthy pods are considered for eviction when using PDBs. (`PDBUnhealthyPodEvictionPolicy`)
3536
--
3637
3738
////

modules/nodes-pods-pod-disruption-configuring.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ spec:
3333
<2> The minimum number of pods that must be available simultaneously. This can
3434
be either an integer or a string specifying a percentage, for example, `20%`.
3535
<3> A label query over a set of resources. The result of `matchLabels` and
36-
`matchExpressions` are logically conjoined. Leave this paramter blank, for example `selector {}`, to select all pods in the project.
36+
`matchExpressions` are logically conjoined. Leave this parameter blank, for example `selector {}`, to select all pods in the project.
3737
+
3838
Or:
3939
+
@@ -53,7 +53,7 @@ spec:
5353
<2> The maximum number of pods that can be unavailable simultaneously. This can
5454
be either an integer or a string specifying a percentage, for example, `20%`.
5555
<3> A label query over a set of resources. The result of `matchLabels` and
56-
`matchExpressions` are logically conjoined. Leave this paramter blank, for example `selector {}`, to select all pods in the project.
56+
`matchExpressions` are logically conjoined. Leave this parameter blank, for example `selector {}`, to select all pods in the project.
5757

5858
. Run the following command to add the object to project:
5959
+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * nodes/nodes-pods-configuring.adoc
4+
// * nodes/nodes-cluster-pods-configuring
5+
// * post_installation_configuration/cluster-tasks.adoc
6+
7+
:_content-type: PROCEDURE
8+
[id="pod-disruption-eviction-policy_{context}"]
9+
= Specifying the eviction policy for unhealthy pods
10+
11+
When you use pod disruption budgets (PDBs) to specify how many pods must be available simultaneously, you can also define the criteria for how unhealthy pods are considered for eviction.
12+
13+
You can choose one of the following policies:
14+
15+
IfHealthyBudget:: Running pods that are not yet healthy can be evicted only if the guarded application is not disrupted.
16+
17+
AlwaysAllow:: Running pods that are not yet healthy can be evicted regardless of whether the criteria in the pod disruption budget is met. This policy can help evict malfunctioning applications, such as ones with pods stuck in the `CrashLoopBackOff` state or failing to report the `Ready` status.
18+
19+
:FeatureName: Specifying the unhealthy pod eviction policy for pod disruption budgets
20+
include::snippets/technology-preview.adoc[]
21+
22+
To use this Technology Preview feature, you must have enabled the `TechPreviewNoUpgrade` feature set.
23+
24+
[WARNING]
25+
====
26+
Enabling the `TechPreviewNoUpgrade` feature set on your cluster cannot be undone and prevents minor version updates. You should not enable this feature set on production clusters.
27+
====
28+
29+
.Procedure
30+
31+
. Create a YAML file that defines a `PodDisruptionBudget` object and specify the unhealthy pod eviction policy:
32+
+
33+
.Example `pod-disruption-budget.yaml` file
34+
[source,yaml]
35+
----
36+
apiVersion: policy/v1
37+
kind: PodDisruptionBudget
38+
metadata:
39+
name: my-pdb
40+
spec:
41+
minAvailable: 2
42+
selector:
43+
matchLabels:
44+
foo: bar
45+
unhealthyPodEvictionPolicy: AlwaysAllow <1>
46+
----
47+
<1> Choose either `IfHealthyBudget` or `AlwaysAllow` as the unhealthy pod eviction policy. The default is `IfHealthyBudget` when the `unhealthyPodEvictionPolicy` field is empty.
48+
49+
. Create the `PodDisruptionBudget` object by running the following command:
50+
+
51+
[source,terminal]
52+
----
53+
$ oc create -f pod-disruption-budget.yaml
54+
----
55+
56+
With a PDB that has the `AlwaysAllow` unhealthy pod eviction policy set, you can now drain nodes and evict the pods for a malfunctioning application guarded by this PDB.

nodes/clusters/nodes-cluster-pods-configuring.adoc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ As an administrator, you can create and maintain an efficient cluster for pods.
1010

1111
By keeping your cluster efficient, you can provide a better environment for your developers using
1212
such tools as what a pod does when it exits, ensuring that the required number of pods is always running,
13-
when to restart pods designed to run only once, limit the bandwidth available to pods, and how to keep
13+
when to restart pods designed to run only once, limit the bandwidth available to pods, and how to keep
1414
pods running during disruptions.
1515

1616
// The following include statements pull in the module files that comprise
@@ -26,7 +26,14 @@ include::modules/nodes-pods-pod-disruption-about.adoc[leveloffset=+1]
2626

2727
include::modules/nodes-pods-pod-disruption-configuring.adoc[leveloffset=+2]
2828

29+
include::modules/pod-disruption-eviction-policy.adoc[leveloffset=+2]
30+
31+
[role="_additional-resources"]
32+
.Additional resources
33+
34+
* xref:../../nodes/clusters/nodes-cluster-enabling-features.adoc#nodes-cluster-enabling[Enabling features using feature gates]
35+
* link:https://kubernetes.io/docs/tasks/run-application/configure-pdb/#unhealthy-pod-eviction-policy[Unhealthy Pod Eviction Policy] in the Kubernetes documentation
36+
2937
include::modules/nodes-pods-configuring-pod-critical.adoc[leveloffset=+1]
3038

3139
// modules/nodes-pods-configuring-run-once.adoc[leveloffset=+1]
32-

nodes/pods/nodes-pods-configuring.adoc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ As an administrator, you can create and maintain an efficient cluster for pods.
1010

1111
By keeping your cluster efficient, you can provide a better environment for your developers using
1212
such tools as what a pod does when it exits, ensuring that the required number of pods is always running,
13-
when to restart pods designed to run only once, limit the bandwidth available to pods, and how to keep
13+
when to restart pods designed to run only once, limit the bandwidth available to pods, and how to keep
1414
pods running during disruptions.
1515

1616
// The following include statements pull in the module files that comprise
@@ -26,8 +26,14 @@ include::modules/nodes-pods-pod-disruption-about.adoc[leveloffset=+1]
2626

2727
include::modules/nodes-pods-pod-disruption-configuring.adoc[leveloffset=+2]
2828

29-
include::modules/nodes-pods-configuring-pod-critical.adoc[leveloffset=+1]
29+
include::modules/pod-disruption-eviction-policy.adoc[leveloffset=+2]
3030

31-
// modules/nodes-pods-configuring-run-once.adoc[leveloffset=+1]
31+
[role="_additional-resources"]
32+
.Additional resources
3233

34+
* xref:../../nodes/clusters/nodes-cluster-enabling-features.adoc#nodes-cluster-enabling[Enabling features using feature gates]
35+
* link:https://kubernetes.io/docs/tasks/run-application/configure-pdb/#unhealthy-pod-eviction-policy[Unhealthy Pod Eviction Policy] in the Kubernetes documentation
3336
37+
include::modules/nodes-pods-configuring-pod-critical.adoc[leveloffset=+1]
38+
39+
// modules/nodes-pods-configuring-run-once.adoc[leveloffset=+1]

post_installation_configuration/cluster-tasks.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,13 @@ Understand and configure pod disruption budgets.
668668

669669
include::modules/nodes-pods-pod-disruption-about.adoc[leveloffset=+2]
670670
include::modules/nodes-pods-pod-disruption-configuring.adoc[leveloffset=+2]
671+
include::modules/pod-disruption-eviction-policy.adoc[leveloffset=+2]
672+
673+
[role="_additional-resources"]
674+
.Additional resources
675+
676+
* xref:../nodes/clusters/nodes-cluster-enabling-features.adoc#nodes-cluster-enabling[Enabling features using feature gates]
677+
* link:https://kubernetes.io/docs/tasks/run-application/configure-pdb/#unhealthy-pod-eviction-policy[Unhealthy Pod Eviction Policy] in the Kubernetes documentation
671678

672679
[id="post-install-rotate-remove-cloud-creds"]
673680
== Rotating or removing cloud provider credentials

0 commit comments

Comments
 (0)