Loading

Pod disruption budget

ECK

A Pod Disruption Budget (PDB) allows you to limit the disruption to your application when its pods need to be rescheduled for some reason such as upgrades or routine maintenance work on the Kubernetes nodes.

Elastic Cloud on Kubernetes manages either a single default PDB, or multiple PDBs per Elasticsearch resource depending on the license level of the ECK installation.

Note

In Elastic Cloud on Kubernetes 3.1 and earlier, all clusters follow the default PodDisruptionBudget rules, regardless of license type.

ECK 3.2.0

In Elasticsearch clusters managed by ECK and licensed with an Enterprise license, a separate PDB is created for each type of nodeSet defined in the manifest. This setup allows Kubernetes upgrade or maintenance operations to be executed more quickly. Each PDB permits one Elasticsearch Pod per nodeSet to be disrupted at a time, provided the Elasticsearch cluster maintains the health status described in the following table:

Role Cluster health required Notes
master Yellow
data Green All Data roles are grouped together into a single PDB, except for data_frozen.
data_frozen Yellow Since frozen data tier nodes only host partially mounted indices backed by searchable snapshots additional disruptions are allowed.
ingest Yellow
ml Yellow
coordinating Yellow
transform Yellow
remote_cluster_client Yellow

Single-node clusters are not considered highly available and can always be disrupted regardless of license type.

Note

In Elastic Cloud on Kubernetes 3.1 and earlier, all clusters follow this behavior regardless of license type.

In Elastic Cloud on Kubernetes clusters that do not have an Enterprise license, one Elasticsearch Pod can be taken down at a time, as long as the cluster has a health status of green. Single-node clusters are not considered highly available and can always be disrupted.

In the Elasticsearch specification, you can change the default behavior in two ways. By fully overriding the PodDisruptionBudget within the Elasticsearch spec or by disabling the default PodDisruptionBudget and specifying one or more PodDisruptionBudget(s).

You can fully override the default PodDisruptionBudget by specifying your own PodDisruptionBudget in the Elasticsearch spec.

apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: quickstart
spec:
  version: {{version.stack}}
  nodeSets:
  - name: default
    count: 3
  podDisruptionBudget:
    spec:
      minAvailable: 2
      selector:
        matchLabels:
          elasticsearch.k8s.elastic.co/cluster-name: quickstart
		

This will cause the ECK operator to only create the PodDisruptionBudget defined in the spec. It will not create any additional PodDisruptionBudgets.

Note

maxUnavailable cannot be used with an arbitrary label selector, therefore minAvailable is used in this example.

You can specify a PDB per nodeSet or node role.

apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: quickstart
spec:
  podDisruptionBudget: {}
  version: 9.2.0
  nodeSets:
    - name: master
      count: 3
      config:
        node.roles: "master"
        node.store.allow_mmap: false
    - name: hot
      count: 2
      config:
        node.roles: ["data_hot", "data_content", "ingest"]
        node.store.allow_mmap: false

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: hot-nodes-pdb
spec:
  minAvailable: 1
  selector:
    matchLabels:
      elasticsearch.k8s.elastic.co/cluster-name: quickstart
      elasticsearch.k8s.elastic.co/statefulset-name: quickstart-es-hot
		
  1. Disable the default Elasticsearch pod disruption budget.
  2. Specify pod disruption budget to have 2 master nodes available.
  3. The pods should be in the "quickstart" cluster.
  4. Pod disruption budget applies on all master nodes.
  5. Specify pod disruption budget to have 1 hot node available.
  6. Pod disruption budget applies on nodes of the same nodeset.