@@ -403,3 +403,76 @@ annotations. For example, to limit both pod egress and ingress bandwidth to 10M/
403
403
----
404
404
oc create -f <file_or_dir_path>
405
405
----
406
+
407
+ [[managing-pods-poddisruptionbudget]]
408
+ == Setting Pod Disruption Budgets
409
+
410
+ A _pod disruption budget_ is part of the
411
+ link:http://kubernetes.io/docs/admin/disruptions/[Kubernetes] API, which can be
412
+ managed with `oc` commands like other
413
+ xref:../cli_reference/basic_cli_operations.adoc#object-types[object types]. They
414
+ allow the specification of safety constraints on pods during operations, such as
415
+ draining a node for maintenance.
416
+
417
+ ifdef::openshift-enterprise[]
418
+ [NOTE]
419
+ ====
420
+ Starting in {product-title} 3.4, pod disruption budgets is a feature in
421
+ link:https://access.redhat.com/support/offerings/techpreview[Technology Preview], available only for users with *cluster-admin* privileges.
422
+ ====
423
+ endif::[]
424
+
425
+ `PodDisruptionBudget` is an API object that specifies the minimum number or
426
+ percentage of replicas that must be up at a time. Setting these in projects can
427
+ be helpful during node maintenance (such as scaling a cluster down or a cluster
428
+ upgrade) and is only honored on voluntary evictions (not on node failures).
429
+
430
+ A `PodDisruptionBudget` object's configuration consists of the following key
431
+ parts:
432
+
433
+ * A label selector, which is a label query over a set of pods.
434
+ * An availability level, which specifies the minimum number of pods that must be
435
+ available simultaneously.
436
+
437
+ The following is an example of a `PodDisruptionBudget` resource:
438
+
439
+ ====
440
+ [source,yaml]
441
+ ----
442
+ apiVersion: policy/v1alpha1 <1>
443
+ kind: PodDisruptionBudget
444
+ metadata:
445
+ name: my-pdb
446
+ spec:
447
+ selector: <2>
448
+ matchLabels:
449
+ foo: bar
450
+ minAvailable: 2 <3>
451
+ ----
452
+
453
+ <1> `PodDisruptionBudget` is part of the `policy/v1alpha` API group.
454
+ <2> A label query over a set of resources. The result of `matchLabels` and
455
+ `matchExpressions` are logically conjoined.
456
+ <3> The minimum number of pods that must be available simultaneously. This can
457
+ be either an integer or a string specifying a percentage (for example, `20%`).
458
+ ====
459
+
460
+ If you created a YAML file with the above object definition, you could add it to project with the following:
461
+
462
+ ----
463
+ $ oc create -f </path/to/file> -n <project_name>
464
+ ----
465
+
466
+ You can check for pod disruption budgets across all projects with the following:
467
+
468
+ ----
469
+ $ oc get poddisruptionbudget --all-namespaces
470
+
471
+ NAMESPACE NAME MIN-AVAILABLE SELECTOR
472
+ another-project another-pdb 4 bar=foo
473
+ test-project my-pdb 2 foo=bar
474
+ ----
475
+
476
+ The `PodDisruptionBudget` is considered healthy when there are at least
477
+ `minAvailable` pods running in the system. Every pod above that limit can be
478
+ xref:../admin_guide/out_of_resource_handling.adoc#out-of-resource-eviction-policy[evicted].
0 commit comments