Complete the code to specify the minimum number of pods that must be available during disruptions.
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: my-pdb
spec:
minAvailable: [1]
selector:
matchLabels:
app: myappThe minAvailable field sets the minimum number of pods that must be up during disruptions. Here, '1' means at least one pod stays running.
Complete the code to select pods with label 'app: frontend' for the Pod Disruption Budget.
apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: frontend-pdb spec: minAvailable: 2 selector: matchLabels: app: [1]
The selector.matchLabels field filters pods by their labels. Here, 'frontend' selects pods labeled with app=frontend.
Fix the error in the Pod Disruption Budget by completing the missing field for maximum allowed disruptions.
apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: db-pdb spec: [1]: 1 selector: matchLabels: app: database
The maxUnavailable field sets the maximum number of pods that can be down during disruptions. It is an alternative to minAvailable.
Fill both blanks to create a Pod Disruption Budget that allows at most 2 pods to be unavailable and selects pods labeled 'tier: frontend'.
apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: frontend-pdb spec: [1]: 2 selector: matchLabels: tier: [2]
Using maxUnavailable: 2 allows up to two pods to be down. The selector chooses pods with label tier=frontend.
Fill all three blanks to create a Pod Disruption Budget that requires at least 3 pods available, selects pods labeled 'component: api', and uses the correct API version.
apiVersion: [1] kind: PodDisruptionBudget metadata: name: api-pdb spec: [2]: 3 selector: matchLabels: component: [3]
The correct API version is policy/v1. The field minAvailable: 3 ensures at least three pods stay up. The selector matches pods labeled component=api.