Updating PodDisruptionBudget API version for Cloud Platform - deprecated Kubernetes v1.21
The policy/v1beta1
API version of PodDisruptionBudget (PDB) is deprecated as of Kubernetes release v1.21, and will no longer be served as of v1.25.
Cloud Platform users are encouraged to ensure any PodDisruptionBudget manifests are migrated to use the policy/v1
API version, which is supported on our current cluster version (v1.24 as of writing).
Further details can be found within the Kubernetes deprecation guide
Steps required
To view which apiVersion you are using, run the following kubectl command:
kubectl --namespace <namespace> get pdb <pdb-name> -o yaml
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
...
You are required to update apiVersion
as the following complete example shows:
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: helloworld-pdp
spec:
minAvailable: 1
selector:
matchLabels:
app: helloworld-rubyapp
Note: A behavioural change in switching from policy/v1beta1
to policy/v1
is noted in the documentation as follows:
an empty spec.selector ({}) written to a policy/v1 PodDisruptionBudget selects all pods in the namespace (in policy/v1beta1 an empty spec.selector selected no pods). An unset spec.selector selects no pods in either API version.
Thus a PDB defined like follows:
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: helloworld-pdp
spec:
minAvailable: 1
selector: {}
will apply the configuration to all pods in your namespace.
For additional information on creating PodDisruptionBudgets see here