Kubernetes High Availability with HPA, PDBs, and Zones

Plan Kubernetes application availability with HPA, Pod Disruption Budgets, health probes, and zone-aware scheduling for safe maintenance.

published: reading time: 33 min read author: Geek Workbench updated: November 21, 2026
Quick Summary

Kubernetes application availability depends on separate controls: replica counts and health probes keep workloads serving, HPA adjusts replicas to measured demand, PDBs limit some voluntary evictions, and topology rules influence placement across zones. None can promise that replacement Pods will have somewhere to run. This guide uses Kubernetes v1.37.1 examples and shows how to check the limits before a node drain.

Kubernetes High Availability with HPA, PDBs, and Zones

This guide uses Kubernetes v1.37.1. The examples use autoscaling/v2 for HorizontalPodAutoscaler (HPA) and policy/v1 for PodDisruptionBudget (PDB).

No single Kubernetes setting keeps an application available through every failure. Replica counts, probes, autoscaling, disruption budgets, and zone placement each address a different part of the problem. They still depend on healthy applications, usable capacity, storage behavior, and the control plane.

What each availability control does

Control What it changes What it does not guarantee
Deployment replica count The number of Pod replicas a controller tries to maintain That each replica is ready or can be scheduled
Readiness probe Whether a Pod is included in Service endpoints That another healthy replica or node is available
Liveness and startup probes Whether a container should be restarted or given more startup time Protection from node or zone failure
HPA The desired replica count based on available metrics Spare cluster capacity or a faster response than the metrics pipeline allows
PDB Which evictions through the API eviction path are allowed Protection from involuntary failure, direct deletion, or missing replacement capacity
Topology spread The scheduler’s placement preference or constraint across zones and nodes Equal distribution when domains lack capacity or labels
Control-plane HA Availability of the API and control-plane components Availability of application Pods or their data plane

For the workload controller choices, see the Kubernetes workload resources guide. For affinity and scheduling events, see the advanced Pod scheduling guide.

Control-plane HA is a separate concern

Managed Kubernetes providers operate the control plane for you, but its topology, maintenance process, and availability guarantees vary by provider and service tier. Check the offering you use. In a self-managed cluster, the operator is responsible for API server replicas and load balancing, etcd quorum and backups, and upgrades. Application PDBs do not protect the control plane; workload replica counts and placement do not make the API server highly available either.

When to use each control

HPA suits variable traffic

HPA can help with Web APIs and worker pools when demand changes and the cluster has room to run additional Pods. Its response depends on the metrics source, metric freshness, controller loop, image startup time, and available capacity.

For workers, queue depth can be a useful external metric if the metrics adapter reports it reliably. Request rate or latency can also drive scaling, but each needs an adapter and a target that reflects what the application can handle.

CPU utilization is measured against the CPU request, so an absent or poorly sized request makes the target misleading. Memory utilization can suit some cache-heavy services, but memory often does not fall when replicas increase. Test the metric against load and service-level indicators before relying on it.

There is no universal averageUtilization target. Pick a starting value from load tests, then compare saturation, latency, and cost under expected peaks. HPA cannot react to a signal that your metrics pipeline does not expose in time.

When PDBs matter

Use a PDB when voluntary maintenance should preserve a chosen number of healthy replicas. Stateful applications may need this to avoid taking down too many members during a drain, but a PDB does not know whether the database still has quorum or whether a replica can safely serve traffic.

PDBs affect operations that use the Kubernetes eviction API, including kubectl drain. They can make a drain wait or fail when too few selected Pods are healthy. They do not prevent involuntary node failures, direct Pod deletion, or every form of preemption. PDBs also do not wait for a replacement Pod to become ready before the first permitted eviction.

For quorum-based applications, choose the budget from the application’s own quorum and recovery rules. A count of available Pods is only a proxy; it does not confirm that an etcd, Kafka, or database cluster has quorum.

For application nodes, a PDB can limit evictions through kubectl drain. It may block maintenance when a replica is already unavailable, which is safer for the workload but requires an operator to restore health or choose another recovery action.

When one zone is not enough

Spreading replicas across zones can reduce the impact of a zone outage, provided there is enough capacity and the application and storage can recover. It does not make an outage invisible: surviving replicas may have less capacity, and some workloads use zone-bound storage.

Data residency is a separate question from availability. Check the rules for the data and regions you operate; spreading Pods across zones in one region does not meet every residency requirement.

Node and Pod failure detection and replacement timing depend on the provider, cluster settings, and workload. After a zone loss, check node conditions, Pod readiness, pending replacements, and storage attachment before assuming the cluster will restore capacity. A PDB does not stop the zone failure or reserve capacity in another zone.

Cross-zone traffic can add latency and provider charges. Measure it for the actual region and service path instead of applying a fixed number to every cluster. A topology rule may also place Pods in a different zone than their clients or data stores.

HPA is not always the answer

If the workload has a fixed capacity requirement or no reliable demand metric, a fixed replica count may be simpler. HPA also needs warm capacity: new Pods take time to schedule, pull images, and become ready.

Choosing a combination

Use HPA when a metric tracks demand and a workload can scale horizontally. Use a PDB when a planned eviction should be limited to preserve a chosen number of healthy Pods. Use zone placement rules when the application and its data can run across zones and the cluster has capacity there.

How the controls fit together

flowchart LR
    Metric[Metric source] --> HPA[HPA adjusts desired replicas]
    HPA --> Deployment[Deployment / ReplicaSet]
    Deployment --> Scheduler[Scheduler places Pods]
    Scheduler --> AZ1[Zone A]
    Scheduler --> AZ2[Zone B]
    Scheduler --> AZ3[Zone C]
    Service[Service routes to ready endpoints] --> AZ1
    Service --> AZ2
    Service --> AZ3
    Drain[Eviction request] --> PDB[PDB admits or blocks eviction]
    PDB --> Deployment

HPA changes the Deployment’s desired replica count. The scheduler places replacement Pods when resources and constraints allow. A Service routes to ready endpoints. The PDB is consulted for eligible eviction requests; it does not control ordinary failures or placement.

Configure the HPA

The Horizontal Pod Autoscaler automatically adjusts the number of pod replicas based on CPU utilization, memory usage, or custom metrics.

Basic HPA configuration

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: web-frontend-hpa
  namespace: production
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: web-frontend
  minReplicas: 3
  maxReplicas: 20
  metrics:
    - type: Resource
      resource:
        name: cpu
        target:
          type: Utilization
          averageUtilization: 70
    - type: Resource
      resource:
        name: memory
        target:
          type: Utilization
          averageUtilization: 80
  behavior:
    scaleDown:
      stabilizationWindowSeconds: 300
      policies:
        - type: Percent
          value: 10
          periodSeconds: 60
    scaleUp:
      stabilizationWindowSeconds: 0
      policies:
        - type: Percent
          value: 100
          periodSeconds: 15

These are example targets, not recommended defaults. For CPU and memory utilization, each Pod needs a corresponding resource request; utilization is measured relative to that request. When an HPA has multiple metrics, it uses the largest valid replica recommendation. behavior caps the rate of scale changes; it does not remove metrics or scheduling delay:

  • Scale-down stabilization window of 300 seconds prevents rapid flapping
  • Scale-down limits to 10% of pods per minute
  • Scale-up allows doubling pods in 15 seconds for rapid response

Custom metrics HPA

For metrics beyond CPU and memory, use the custom.metrics.k8s.io API:

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: queue-worker-hpa
  namespace: production
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: queue-worker
  minReplicas: 2
  maxReplicas: 50
  metrics:
    - type: External
      external:
        metric:
          name: queue_depth
          selector:
            matchLabels:
              queue_name: order-processing
        target:
          type: AverageValue
          averageValue: "100"

This scales based on message queue depth. When 100 messages per pod accumulate on average, the HPA adds more pods.

Checking HPA status

kubectl get hpa -n production
kubectl describe hpa web-frontend-hpa -n production

The describe output shows current metrics, replica counts, and scaling events.

If the HPA reports <unknown>, first check that the metrics API or external metrics adapter is available and that the target Pods have the resource requests required by the chosen metric. The HPA can change desired replicas, but the scheduler still needs a node with enough capacity and matching placement constraints.

Compare scaling policies

Scaling Policy Behavior Best For Risk
Aggressive (scale-up) Fast scale-up, slow scale-down Traffic spikes, flash sales Over-provisioning, higher costs
Conservative (scale-down) Slow scale-up, fast scale-down Stable workloads, cost-sensitive Under-provisioning during growth
Stable (long stabilization window) Prevents flapping Predictable traffic, stateful apps Slower response to load changes
Mixed (separate up/down policies) Tune each direction independently Most production workloads More configuration complexity

The default HPA behavior is relatively aggressive on scale-up and conservative on scale-down. For stateful services with database connections, use a longer stabilization window to avoid connection churn during brief load fluctuations.

behavior:
  scaleUp:
    stabilizationWindowSeconds: 0 # Immediately scale up
    policies:
      - type: Percent
        value: 100
        periodSeconds: 15
  scaleDown:
    stabilizationWindowSeconds: 300 # 5 minute cooldown
    policies:
      - type: Percent
        value: 10
        periodSeconds: 60

Use PDBs for voluntary evictions

PodDisruptionBudget (PDB) objects limit voluntary evictions requested through the Kubernetes eviction API. kubectl drain uses this API. A PDB does not prevent a node failure, a direct Pod deletion, or every scheduler preemption; Kubernetes considers PDBs on preemption on a best-effort basis.

PDB definition

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: web-frontend-pdb
  namespace: production
spec:
  minAvailable: 2
  selector:
    matchLabels:
      app: web-frontend

This budget asks Kubernetes to keep at least two selected Pods healthy during allowed evictions. If fewer than two can remain healthy, the eviction is denied. The PDB does not wait for replacements before it admits the first eviction, and it cannot ensure that a replacement will schedule.

Using maxUnavailable instead

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: web-frontend-pdb
  namespace: production
spec:
  maxUnavailable: 1
  selector:
    matchLabels:
      app: web-frontend

maxUnavailable: 1 allows one selected Pod to be unavailable because of disruptions covered by the budget. Either field expresses an eviction limit; neither is an availability probe or a reservation of replacement capacity.

Multiple PDBs for complex applications

# PDB for API servers
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: api-server-pdb
  namespace: production
spec:
  minAvailable: 3
  selector:
    matchLabels:
      tier: api
---
# PDB for frontend
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: frontend-pdb
  namespace: production
spec:
  minAvailable: 2
  selector:
    matchLabels:
      tier: frontend

You can have multiple PDBs for different parts of an application.

Checking PDB status

kubectl get pdb -n production
kubectl describe pdb web-frontend-pdb -n production

Check the ALLOWED DISRUPTIONS value before maintenance. It is based on the controller’s desired replica count and the selected Pods’ current health. If a replica is already unavailable, a budget that previously allowed one disruption may allow none.

Reproduce a drain blocked by an unavailable replica

Run this in a disposable Kubernetes v1.37.1 cluster with at least three worker nodes. The test Deployment spreads one replica per node and uses a readiness probe that can be failed without restarting the container. Save the manifest as ha-test-workload.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: web-frontend
  namespace: ha-test
spec:
  replicas: 3
  selector:
    matchLabels:
      app: web-frontend
  template:
    metadata:
      labels:
        app: web-frontend
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchLabels:
                  app: web-frontend
              topologyKey: kubernetes.io/hostname
      containers:
        - name: hold
          image: busybox:1.36.1
          command: ["sh", "-c", "sleep 3600"]
          readinessProbe:
            exec:
              command: ["sh", "-c", "test ! -e /tmp/unready"]
            periodSeconds: 2
            timeoutSeconds: 1
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: web-frontend-pdb
  namespace: ha-test
spec:
  minAvailable: 2
  selector:
    matchLabels:
      app: web-frontend

Create the namespace and wait for all three replicas to become ready:

kubectl create namespace ha-test
kubectl apply -f ha-test-workload.yaml
kubectl rollout status deployment/web-frontend -n ha-test --timeout=2m
kubectl get pods -n ha-test -l app=web-frontend -o wide
kubectl get pdb web-frontend-pdb -n ha-test

With all three replicas healthy, the PDB should show one allowed disruption. Make one replica unready, then check the PDB again. It should show zero allowed disruptions. Choose a different worker that hosts a healthy web-frontend Pod and try a bounded drain:

pod=$(kubectl get pods -n ha-test -l app=web-frontend -o jsonpath='{.items[0].metadata.name}')
kubectl exec -n ha-test "$pod" -- touch /tmp/unready
kubectl wait --for=condition=Ready=false "pod/$pod" -n ha-test --timeout=30s
kubectl get pdb web-frontend-pdb -n ha-test
kubectl drain <worker-with-a-healthy-web-frontend-pod> \
  --ignore-daemonsets --delete-emptydir-data --timeout=2m

The eviction should be rejected or remain blocked because evicting that healthy Pod would leave fewer than two healthy replicas. Restore the failed replica and confirm the PDB allows a disruption before retrying maintenance. If the replacement is Pending, inspect its events and restore node capacity or resolve its placement constraint. Do not bypass a blocked budget with a force deletion during a routine upgrade; that skips the eviction check rather than fixing availability. The drain cordons its node, so uncordon it before deleting the test namespace:

kubectl exec -n ha-test "$pod" -- rm /tmp/unready
kubectl wait --for=condition=Ready "pod/$pod" -n ha-test --timeout=30s
kubectl uncordon <worker-with-a-healthy-web-frontend-pod>
kubectl delete namespace ha-test

Pod priority and preemption

Pod priority affects scheduling order and eviction decisions during resource pressure. Higher priority pods preempt lower priority pods when the cluster is full.

Priority class definition

apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: production-high
value: 1000
globalDefault: false
description: "Production workloads with high priority"
---
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: production-medium
value: 500
globalDefault: true
description: "Standard production workloads"

globalDefault: true makes this class the default priority for Pods without an explicit priorityClassName; use that setting only if cluster-wide default priority is intentional.

Assigning priority to pods

spec:
  priorityClassName: production-high

Critical workloads like payment processing use high priority. Background batch jobs use lower priority and get preempted when needed.

Spread replicas across zones

Zone-aware placement can reduce the chance that one outage removes every replica. It works only when the cluster has eligible nodes and capacity in the zones the workload can use.

Check zone labels

Nodes have topology labels:

topology.kubernetes.io/zone: us-east-1a
topology.kubernetes.io/region: us-east-1

Topology spread across zones

Put this field under the Pod template’s spec in a Deployment. ScheduleAnyway asks the scheduler to prefer a balanced spread but lets it place a Pod when exact balance is impossible. Use DoNotSchedule only when a strict spread is more important than placing every replica; an unsatisfied constraint leaves the Pod Pending.

spec:
  topologySpreadConstraints:
    - maxSkew: 1
      topologyKey: topology.kubernetes.io/zone
      whenUnsatisfiable: ScheduleAnyway
      labelSelector:
        matchLabels:
          app: web-frontend

This is a preference, not a promise that one Pod will land in each zone. The scheduler only considers eligible nodes that have the selected zone label, and it also checks resources, taints, affinity rules, and storage. A hard DoNotSchedule constraint can leave new replicas Pending when a zone or its capacity is unavailable.

Storage considerations

Persistent volumes with cloud provider storage may have zone constraints. For example, a zonal EBS volume can only attach in its availability zone. A Pod scheduled in a different zone cannot use that volume.

For a topology-constrained CSI driver that supports it, WaitForFirstConsumer delays provisioning and binding until a Pod uses the claim. The scheduler can then account for the Pod’s placement constraints when selecting storage. It is not a general fix for every Pending claim; check the driver and StorageClass documentation.

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: ebs-sc
provisioner: ebs.csi.aws.com
parameters:
  type: gp3
volumeBindingMode: WaitForFirstConsumer

The driver provisions the volume in a topology compatible with the Pod’s scheduling decision. Existing volumes still follow their own topology and attachment rules.

StatefulSet storage and replication

StatefulSet identity and storage do not make an application replication-safe. If its volumes are zonal, a replacement Pod may have to wait for its original zone or for a supported storage recovery path. Test quorum, failover, and restore behavior in the database itself; a PDB and zone-spread rule cannot supply those behaviors.

A multi-cluster setup is a separate design

Multiple clusters can isolate some failure domains, but they add separate identity, networking, data consistency, and rollout decisions. They do not create automatic failover between clusters. This post focuses on one cluster; see the multi-cluster Kubernetes guide before choosing a cross-cluster management approach.

Test failure recovery

Run failure drills in a disposable or explicitly isolated environment. Confirm the application can recover before running destructive chaos tooling against any shared cluster.

Use a chaos tool in an isolated cluster

helm install chaoskube chaoskube/chaoskube \
  --set namespaces={production} \
  --set schedule="*/5 * * * *" \
  --set replicas=1

This example targets a namespace literally named production; do not install it in a live environment as written. Configure the tool for a disposable test namespace and first verify that your chosen failure action and schedule are safe.

Drain a worker node

kubectl drain node-1 --ignore-daemonsets --delete-emptydir-data --timeout=2m

Run this only on a worker node in the test cluster. The API eviction path honors matching PDBs, so a drain may wait or time out if the budget has no allowed disruptions. Check both placement and application behavior:

  • PDBs are respected
  • Pods reschedule to other nodes
  • The Service has the expected number of ready endpoints
  • The application remains within its latency and error objectives

Load test HPA behavior

Verify HPA responds correctly under load:

kubectl run -it load-generator \
  --image=busybox \
  --restart=Never \
  -- /bin/sh -c "while true; do wget -q -O- http://web-frontend; done"

Monitor HPA behavior during the test:

watch kubectl get hpa -n production

Failure scenarios

HPA changes direction too often

Rapid changes in both directions can waste capacity and interrupt warm-up work.

Look for noisy or stale metrics, an unsuitable target, slow startup, or a stabilization window that does not match the workload.

Use behavior to limit how quickly replicas change, then tune the windows from observed metric noise and application startup time. Five minutes is an example value, not a default for every workload.

A PDB blocks a drain

If minAvailable equals the desired replica count, no selected Pod can be evicted while all replicas are healthy. If one replica is already unhealthy, a lower value can also leave disruptionsAllowed at zero. A drain may wait or time out until the workload recovers. Choose the budget from the application’s safe operating level, and plan how to repair an unavailable replica before maintenance.

Replicas land in one zone

If all replicas happen to run in one zone, losing that zone can remove the whole workload at once. A replica count alone does not distribute Pods.

Use zone labels and a topology spread rule if the workload can run in multiple zones. Check the actual node distribution after rollout and keep enough capacity in the remaining zones for recovery.

Common mistakes

minReplicas: 1

With one replica, any restart or node failure can interrupt the service until a replacement is ready. Whether two or more replicas are appropriate depends on startup time, capacity, and the application’s ability to serve concurrently.

A PDB is too strict

A budget that requires every desired replica to stay healthy can block voluntary eviction. Set it from the application’s minimum safe healthy count, and include an operator recovery plan for a stuck drain.

Treating HPA and PDB as one control

HPA and PDB solve different problems. HPA changes the desired replica count from metrics; a PDB controls eligible evictions. Use a PDB when there is a meaningful minimum healthy count during maintenance, and verify the HPA metric and budget together under a drain. A PDB is not required for every workload.

Where VPA fits

The Vertical Pod Autoscaler is a separate add-on, not part of the Kubernetes core API server. It can recommend Pod resource requests or apply them according to its update mode. An eviction-based mode can restart Pods and must be considered alongside any PDB.

VPA update modes

Mode Behavior Use case
Off Records recommendations without changing Pods Review recommendations first
Initial Applies resources when Pods are created New Pods should use the recommendation
Recreate Applies updates by evicting and recreating Pods The workload can tolerate restarts
InPlaceOrRecreate Tries an in-place resize, then recreates if needed The installed VPA and cluster support in-place resizing

Configure VPA recommendations

apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
  name: api-vpa
  namespace: production
spec:
  targetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: api-backend
  updatePolicy:
    updateMode: "Recreate"
  resourcePolicy:
    containerPolicies:
      - containerName: api
        minAllowed:
          cpu: 100m
          memory: 128Mi
        maxAllowed:
          cpu: 4
          memory: 8Gi

Combine VPA with HPA carefully

VPA and HPA can be combined, but do not let both controllers adjust the same resource signal without testing their interaction. The VPA project warns against using VPA and HPA on the same CPU or memory metric. A common arrangement is VPA recommendations in Off mode plus HPA on an external metric, but metric and update policies depend on the workload. The example below illustrates the separate APIs; it is not a default to copy into production:

# VPA for resource sizing
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
  name: api-vpa
spec:
  targetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: api-backend
  updatePolicy:
    updateMode: "Off"
---
# HPA for replica scaling
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: api-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: api-backend
  minReplicas: 2
  maxReplicas: 20
  metrics:
    - type: External
      external:
        metric:
          name: queue_depth
          selector:
            matchLabels:
              queue_name: orders
        target:
          type: AverageValue
          averageValue: "100"

Here the HPA metric is an external queue-depth metric, so changing CPU requests does not also change the HPA’s utilization denominator. The VPA is only recording recommendations. If you later enable updates, select an explicit mode supported by the VPA version you install and account for restarts, PDBs, and node capacity.

Observe availability

Metrics to watch

# HPA scaling events
kube_horizontalpodautoscaler_status_condition{condition="AbleToScale"}

# HPA current vs desired replicas
kube_horizontalpodautoscaler_status_current_replicas
kube_horizontalpodautoscaler_status_desired_replicas

# PDB healthy Pods and permitted evictions
kube_poddisruptionbudget_status_current_healthy
kube_poddisruptionbudget_status_desired_healthy
kube_poddisruptionbudget_status_pod_disruptions_allowed

# Pod restarts by deployment (evictions vs crashes)
kube_pod_container_status_restarts_total

# Node availability by zone
kube_node_status_condition{condition="Ready"}

Events to inspect

  • HPA scale-up and scale-down events (check kubectl get events --watch)
  • PDB disruptionsAllowed reaching zero during a planned drain
  • VPA resource recommendations applied
  • Pod preemption events (higher priority pods evict lower ones)

Example alerts

Alert Condition Severity
HPA at max replicas kube_horizontalpodautoscaler_status_current_replicas == kube_horizontalpodautoscaler_spec_max_replicas for >5min Warning
HPA flapping Scale direction changes 4+ times in 10min Warning
PDB has no allowed eviction kube_poddisruptionbudget_status_pod_disruptions_allowed == 0 while a drain is pending Warning
Pod preemption events kube_pod_status_nominated_node_name != "" increasing Info
VPA recommendations ignored Pod OOMKilled despite VPA recommendations Warning

Debug commands

# Check HPA current state
kubectl get hpa -n production

# Watch HPA scaling decisions
kubectl get events --watch --field-selector involvedObject.kind=HorizontalPodAutoscaler

# Check PDB status
kubectl get pdb -n production
kubectl describe pdb web-frontend-pdb -n production

# Check VPA recommendations (without applying)
kubectl get vpa -n production -o yaml | grep -A 50 recommendation

# Check for preemption events
kubectl get events --sort-by='.lastTimestamp' | grep -i preempt

Interview Questions

1. Your multi-AZ Kubernetes cluster lost one availability zone. Walk through what happens and how you recover.

Detection and replacement timing depend on the provider and cluster settings. The node controller eventually marks unreachable nodes unhealthy; a Deployment may create replacements, but they still need schedulable capacity. A PDB does not block the involuntary failure or reserve capacity. Check node conditions, ready replicas, Pending Pod events, and storage attachment. A zonal volume may keep a StatefulSet Pod tied to the failed zone. Do not force-delete a Pod until the old node is fenced or the storage owner confirms that a second writer cannot start.

2. You have a 3-node etcd cluster and one node fails. What happens and how do you recover?

A healthy three-member etcd cluster can usually tolerate one member failure because the remaining two still form a quorum. The exact recovery steps depend on the failure and etcd version; do not remove and re-add a member just because it is temporarily offline. Follow the etcd recovery procedure, confirm a healthy quorum, and keep a tested snapshot backup. Managed providers operate their control plane under the terms of the chosen service tier; self-managed operators own quorum, backups, and recovery.

3. What should a Kubernetes control-plane upgrade plan cover?

Follow the upgrade procedure for the exact managed service or Kubernetes distribution; neither a PDB nor a worker-node drain makes a control-plane upgrade zero-downtime. For a self-managed cluster, back up and verify etcd, then follow the supported version-skew and component sequence for that release. Plan API endpoint failover and test recovery before upgrading. Upgrade worker nodes separately with cordon and drain, checking the PDB and application readiness at each step. A single-control-plane development cluster needs a maintenance window.

4. How does HPA flapping occur and how do you prevent it?

Flapping is repeated scaling in opposite directions as the measured metric crosses the target. Check metric noise, missing samples, startup time, and resource requests before changing the threshold. HPA's behavior fields can limit scale rates and add a stabilization window; choose those values from observed traffic and recovery time rather than treating five minutes as a rule.

5. What is the difference between voluntary and involuntary disruptions in Kubernetes? Why does this distinction matter for PDB design?

Involuntary disruptions include node failure and similar events the workload owner did not choose. Voluntary evictions are requests made through the eviction API, such as the ones kubectl drain sends. A PDB affects those eviction requests. It does not govern a Deployment scale-down or a direct Pod deletion, and preemption only considers PDBs on a best-effort basis.

This distinction matters because a PDB cannot stop a zone outage. Controllers may create replacements after a failure, but replacement depends on capacity, storage, and scheduling rules. Zone spread reduces the chance that all replicas share one failure domain; it cannot guarantee a minimum number will survive every outage.

6. How do topology spread constraints improve upon podAntiAffinity for multi-AZ high availability?

Pod anti-affinity can require or prefer that replicas avoid a topology domain. Topology spread constraints express a maximum skew and a choice between hard placement and a soft preference. With maxSkew: 1 and zone topology, the scheduler tries to keep selected Pods within one of each other across eligible zones.

That does not guarantee one Pod in each of three zones. Available nodes, labels, resources, and other constraints matter. ScheduleAnyway prefers balance but can place a Pod in a less balanced domain; DoNotSchedule can leave it Pending when the rule cannot be met. After a zone loss, inspect both the distribution and the replacement Pods' scheduling events.

7. Explain how a Pod Disruption Budget interacts with a Horizontal Pod Autoscaler during a node drain operation.

HPA calculates desired replicas from its configured metrics; it does not scale simply because a Pod was evicted. The PDB separately decides whether a voluntary eviction request is allowed. During a drain, a permitted eviction can reduce the number of ready replicas while a replacement starts. Later evictions may be blocked until the budget recovers. If a Pod was already unhealthy, the PDB may allow no further evictions. Check the HPA metric, the PDB's disruptionsAllowed, and replacement scheduling rather than assuming the two controllers will keep service capacity constant.

8. What are the trade-offs between minAvailable and maxUnavailable in a Pod Disruption Budget? When would you choose one over the other?

minAvailable sets a floor for healthy selected Pods; maxUnavailable caps the number or fraction the budget may mark unavailable. They describe the same eviction budget from different sides. They do not set rollout behavior or guarantee that a service is healthy.

Use a count when the application has a known minimum number of healthy replicas. A percentage can follow a changing desired replica count, but review rounding for small workloads. For quorum systems, derive the value from the application's membership and recovery rules; a PDB counts Pod health, not application quorum.

9. How does a DaemonSet contribute to high availability in a Kubernetes cluster? What are its HA limitations?

A DaemonSet tries to run one Pod on each eligible node, which suits node agents such as log collectors or networking components. A failed node does not become healthy because its DaemonSet Pod is desired; the controller creates Pods for eligible nodes as the cluster changes.

A DaemonSet has no fixed replica count. Its Pod count follows the number of eligible nodes, so it is not a substitute for a Deployment when an application needs a chosen number of replicas independent of cluster size.

10. Describe how you would design an ingress controller setup for high availability across availability zones.

Run enough controller replicas to survive the failure you are designing for, then place them across eligible zones. The cloud load balancer's target registration and cross-zone behavior depend on the provider and ingress implementation; verify those settings in its documentation.

Use readiness probes so Services stop routing to unready Pods, and test the controller's own configuration and leader-election behavior. A PDB may limit voluntary evictions during worker maintenance, but it cannot guarantee traffic continuity if the provider load balancer, network path, or all controller replicas fail.

11. How can etcd latency affect API server responsiveness?

API writes are persisted through etcd, so slow etcd responses can increase API request latency. The effect depends on request type and cluster load; one latency number does not describe every API operation.

Monitor API server request latency alongside etcd disk, proposal, and leader metrics. Investigate the underlying storage, network, and request load when those metrics move away from the cluster's baseline. Managed providers operate control-plane infrastructure, but customers still need to understand the service health and maintenance signals they expose.

12. How do you design a node pool strategy for production workloads requiring both compute optimization and high availability?

Use node pools when a workload needs different hardware, maintenance, or scaling behavior. How a pool spans zones and how its autoscaler adds capacity depend on the provider and node-management tool.

Check that each required zone has enough eligible nodes for the Pods' resource requests and placement rules. Taints and tolerations can reserve specialized nodes, but do not reserve capacity by themselves. Keep system workloads and applications separate only when you have a concrete isolation or capacity reason.

13. What is the relationship between PodDisruptionBudgets and readiness probes in maintaining service availability during disruptions?

A readiness probe controls whether a Pod is eligible for Service traffic. A PDB controls whether an eligible voluntary eviction request can proceed. A not-ready Pod can reduce the PDB's available count, leaving no disruptions allowed. A ready Pod may still fail after traffic reaches it, so readiness probes need to reflect whether the application can serve requests.

Neither mechanism prevents a node failure. Test probe thresholds under startup and load conditions, and verify the PDB status before maintenance.

14. Explain how control plane HA in managed Kubernetes differs from self-managed deployments in terms of etcd quorum and API server availability.

Managed providers operate the control plane according to the selected service tier and its SLA. The topology, maintenance behavior, and customer responsibilities differ, so check the provider's current documentation rather than assuming a particular etcd layout or zero-downtime upgrade.

Self-managed clusters require the operator to run and load-balance API servers, maintain etcd quorum and backups, configure controller-manager and scheduler leader election, and test upgrades and recovery. Losing etcd quorum prevents normal writes to cluster state. Neither a workload PDB nor application Pod replicas protect these control-plane components.

15. How does etcd write performance affect Kubernetes cluster responsiveness, and what metrics would you monitor to detect degradation early?

etcd stores cluster state, and quorum is needed for writes. Track etcd WAL fsync duration, failed proposals, and leader changes alongside API request latency. Compare them with the cluster's normal baseline and workload SLOs; a single threshold does not fit every storage system or cluster size.

When control-plane latency rises, inspect etcd storage and network health, API request volume, and controller work before attributing the issue to one component. Managed clusters expose a different set of metrics than self-managed clusters, so use the signals available in the chosen service.

16. Describe the failure modes of a StatefulSet with PersistentVolumes during an availability zone outage and how to mitigate them.

A Pod backed by a zonal volume can remain unschedulable outside that volume's zone. A StatefulSet preserves Pod identity and reuses its claim; it does not replicate the data or automatically move a zonal disk to another zone. Do not force-delete the Pod until the old node is fenced and the storage system confirms that a second writer cannot access the volume.

Use a storage service and database replication design that support the recovery objective. Test restoring or promoting a replica, then check the claim, attachment, and Pod events during an outage drill. A PDB can limit eligible voluntary evictions before the outage, but it cannot make unavailable storage work or ensure database quorum.

17. How would you reduce risk during a self-managed control-plane upgrade?

There is no distribution-independent upgrade sequence. Back up etcd, verify the backup, and follow the supported version-skew and component order for the cluster distribution. Confirm the API endpoint and control-plane health after each stage. For a managed cluster, use its documented maintenance workflow and service-tier guarantees.

Upgrade worker nodes as a separate operation: cordon one node, inspect matching PDBs, drain through the eviction API, update it, then uncordon and verify the replacement Pods are ready before continuing. A PDB can block a drain; it does not promise zero downtime or control the control-plane upgrade.

18. How does pod affinity and anti-affinity interact with the Kubernetes scheduler to distribute workloads across topology domains?

Pod affinity rules tell the scheduler to place pods relative to other pods (same node, same zone, or different zone). Anti-affinity tells the scheduler to avoid placing pods near other pods. During scheduling, the scheduler evaluates these rules alongside resource availability and other constraints.

requiredDuringSchedulingIgnoredDuringExecution is a hard placement rule and can leave a Pod Pending if no eligible node satisfies it. preferredDuringSchedulingIgnoredDuringExecution is a soft preference. Topology spread constraints provide a maxSkew rule and choose either DoNotSchedule or ScheduleAnyway. Check the actual node labels and events; none of these rules add capacity to a zone.

19. You have a Deployment with 5 replicas using a PDB with minAvailable: 4. During a rolling update, what happens when you try to drain a node?

A Deployment rollout uses its own maxSurge and maxUnavailable settings. A PDB does not govern Pod deletions made by the Deployment controller during that rollout. If you drain a node at the same time, the eviction API checks the PDB against the controller's desired count and current healthy Pods; do not infer the allowed evictions by counting temporary surge Pods.

For a safer upgrade, let the rollout finish first, confirm all five replicas are ready, and inspect kubectl get pdb. Then drain one node and watch whether disruptionsAllowed returns before proceeding to another node. If the drain is blocked, restore workload health or capacity rather than assuming the PDB will coordinate both operations.

20. What are the specific trade-offs when choosing between cluster-level anti-affinity (spreading across all zones) versus node-level anti-affinity (spreading across nodes within a single zone) for a stateless web application?

Zone-level placement reduces the chance that one zone failure removes every replica, but it can add network cost and does not guarantee capacity after an outage. Node-level placement reduces co-location on one machine but does not protect against a zone loss.

You can combine zone and hostname topology spread constraints when the workload and cluster have enough eligible domains. Decide whether each rule is a soft preference or a hard constraint: a strict rule may leave Pods Pending during an outage. Measure the network path and verify placement after rollout instead of assuming a universal best layout.

Further Reading

Conclusion

HPA, PDBs, health probes, and zone placement address different failure paths. HPA adjusts desired replicas from metrics. A PDB can block an eligible eviction when too few selected Pods are healthy. Probes affect readiness and restarts, while topology rules influence where new Pods may run.

Before a drain, check replica health, disruptionsAllowed, and capacity in the zones where replacements can run. Treat control-plane HA and application availability as separate plans, and test storage recovery for stateful workloads.

Run node-drain and load drills in a test cluster first. A successful drain or HPA response in one setup does not guarantee the same result after a provider, workload, or topology change.

For more on advanced Kubernetes patterns, see the Advanced Kubernetes post.

Category

Related Posts

Health Checks: Liveness, Readiness, and Service Availability

Master health check implementation for microservices including liveness probes, readiness probes, and graceful degradation patterns.

#microservices #health-checks #kubernetes

Container Security: Image Scanning and Vulnerability Risks

Implement comprehensive container security: from scanning images for vulnerabilities to runtime security monitoring and secrets protection.

#container-security #docker #kubernetes

Deployment Strategies: Rolling, Blue-Green, Canary

Compare and implement deployment strategies—rolling updates, blue-green deployments, and canary releases—to reduce risk and enable safe production releases.

#deployment #devops #kubernetes