How to Configure a Pod Disruption Budget in Kubernetes

We are going to show you how you can configure a pod disruption budget in Kubernetes. This article is for anyone who wants to learn how to minimize the interruptions that are experienced by different applications so that the cluster administrator can have the highest access for managing the cluster nodes. In this guide, we will demonstrate what is the pod disruption budget and how it can be created and validated for a Kubernetes application.

What Is a Kubernetes Pod Disruption Budget (PDB)?

In Kubernetes, when anything creates an interruption in the operation of a pod, that interruption is considered a disruption. The disruption could be of any type like accidentally using the “kubectl delete” command instead of the “kubectl get” command or a node that requires rebooting due to a system crash, etc. However, voluntary disruptions can also occur in case the disruption is caused by an operator like a node being drained or the deployment being deleted.

When an application’s pod needs to be rescheduled for a specific reason like routine maintenance, an upgrade, or anything else, the application faces many disruptions along the rescheduling process. The Pod Disruption Budget (PDB) is a method in Kubernetes that is used to limit those disruptions so that an application can run the rescheduling process smoothly. The PDB allows the owner of the application to set the requirements for the Deployment so that the application gets less interrupted by any kind of disruption. In other words, PDB allows the owner of the application to specify the operational requirements that can be tolerated by a Deployment so that it can stay stable when a disruption occurs.

Let us learn how to configure a Pod Disruption Budget for a Kubernetes application with the help of the following step-by-step guide.


Before you begin, make sure your that system meets all the needed prerequisites. You must have Ubuntu 20.02 or any other latest version installed in your system. On top of that, you need to have a virtual machine enabled so that the Kubernetes terminal can be used. Moreover, you must be the owner of the Kubernetes application which runs on the Kubernetes cluster. The last thing that you need is to ensure that the Kubernetes cluster allows you to set the Pod Disruption Budget.

Now, let us configure the Pod Disruption Budget in Kubernetes. Follow the following steps for the configuration:

Step 1: Start the Kubernetes

When you need to work with Kubernetes, the first step is to start the Kubernetes so that you can have complete access to the Ubuntu virtual machine. The minikube is a Kubernetes environment or, in simple words, it is a dashboard terminal that is used to run the apps and commands. To start the minikube, the “start” command is used as follows:

> minikube start

Enter this command on the Kubernetes terminal and press enter. On the command execution, you will get the following response:

Once you have the Kubernetes terminal up and running successfully, you need to decide how your Kubernetes application should react to the disruptions. The two main things that you need to specify are the minimum available parameter limit and the maximum unavailable parameter limit. The minavailable parameter specifies how many pods should always be available even if a disruption occurs. The maxunavailable parameter specifies how many pods can be unavailable at a time in case of disruption. The value for minavailable and maxunavailable can be set as an integer or it can be a percentage. Now, let us see how to create a PDB object as a YAML file using the minavailable and maxunavailable parameters.

Step 2: Create a YAML File for the Pod Disruption Budget Definition

Now that our Kubernetes dashboard is up and running successfully, as seen in the previous screenshot, we are ready to start the configuration of the Pod Disruption Budget (PDB) for a Kubernetes application. To open or create a new file, Kubernetes provides a “nano” command. Here, we will create a YAML file for the Pod Disruption Budget (PDB) definition using the following command:

> nano pdbmin.yaml

The “nano” is the Kubernetes command which creates a file. The “pdbmin” is the file name which is specified by the user. And “.yaml” is the extension of the file which is about to be created. Write this command on the Kubernetes terminal and press enter from the keyboard.

Here, we use the minavailable parameter to set the tolerable operational requirements of the PDB. As you can see in the following screenshot, the value of the minavailable parameter is 2 which means that 2 pods must be available all the time even if the disruption occurs to the application.

Let us create another PDB definition as a YAML file using the maxunavailable parameter. Use the same “nano” command to create the PDB definition as a YAML file:

> nano pdmax.yaml

As you can see in the following screenshot, the value for the maxunavailable parameter is 1 which means that only 1 pod can be unavailable in case of disruption.

Step 3: Create a Pod Disruption Budget (PDB) Object

The next step is to create the object of the PDB from the YAML definitions that were previously created. Use the “kubectl apply” instruction to create the PDB object:

> kubectl apply -f pdmax.yaml

As you can see in the output, the object has been successfully created.

Step 4: Check the Pod Disruption Budget (PDB) Object Status

Now, let us verify the status of the recently created PDB object. Use the “kubectl get” instruction to verify the status of the PDB object. Enter the “kubectl get” command on the terminal and see the status of the PDB object:

> kubectl get poddisruptionbudgets

Remember that we set the maxunavailable value to 1, which is shown in the previous output.

If you want to see the detailed status of the Pod Disruption Budget (PDB) object, you can use the “kubectl get” command as follows:

> kubectl get poddisruptionbudgets zk-pdb -o yaml


This article presented how to create a Pod Distribution Budget (PDB) definition using the minavailable and maxunavailable parameters for the Kubernetes application. We then learned how to create the PDB object from the defined YAML definitions and checked the status of the created object using the kubectl command. By following the given steps , you will learn to create and configure the PDB objects and validate whether the object is working properly.

About the author

Kalsoom Bibi

Hello, I am a freelance writer and usually write for Linux and other technology related content