Skip to main content
Back to All Whitepapers/Kubernetes & EKS
Kubernetes & EKSMarch 10, 20267 min read

Kubernetes Production Best Practices: Multi-AZ Reliability & Security

Essential architectural patterns for running mission-critical Kubernetes workloads on AWS EKS and GCP GKE with zero downtime.

SA

Sikander Ali

Senior DevOps Architect (AWS Pro, CKA)

Executive Engineering Summary & Takeaways

  • Multi-AZ node group distribution across at least three distinct Availability Zones prevents complete cluster outage during cloud data center fiber cuts.
  • Configuring PodDisruptionBudgets (PDB) and topology spread constraints guarantees continuous quorum during routine node upgrades and Karpenter auto-scaling.
  • Enforcing guaranteed Quality of Service (QoS) through symmetrical memory requests and limits eliminates Linux kernel Out-Of-Memory (OOM) killer eviction loops.
  • Zero-trust NetworkPolicies combined with Pod Security Standards (PSS Restricted) block lateral privilege escalation and malicious container network traversal.
  • Graceful termination lifecycles utilizing preStop sleep hooks and SIGTERM handling prevent dropped in-flight HTTP connections during rolling deployments.

1. The High-Availability Baseline: Why Single-Zone & Default Configurations Fail

Deploying Kubernetes workloads using default configuration manifests is one of the most hazardous mistakes in cloud infrastructure. Out-of-the-box, Kubernetes is designed for flexibility, not enterprise resilience. By default, pods run with root privileges, have unlimited access to host memory and CPU, can initiate arbitrary outbound network calls, and are scheduled onto whatever node happens to have capacity—often clustering all replicas into a single availability zone.

When a cloud provider experiences an isolated availability zone power outage, network partition, or fiber cut, organizations with uncalibrated clusters suffer catastrophic total service downtime. Even routine maintenance events—such as Kubernetes control plane upgrades, node AMI security patches, or Karpenter spot node reclamations—can cause cascading 502 Bad Gateway outages if pods lack disruption budgets and graceful termination hooks.

To achieve true 99.99% availability on AWS EKS or GCP GKE, engineering teams must configure multi-AZ topology spread constraints, guaranteed Quality of Service (QoS) resource sizing, strict network segmentation, and automated canary rollouts.

Live Capability

Reliability Metric: Properly configuring PodDisruptionBudgets and preStop hooks eliminates over 99.5% of dropped HTTP connections during routine cluster rolling deployments and node maintenance drains.

2. Cluster Topology & Blast Radius: Multi-AZ Node Pools, Control Plane Isolation & Ingress

Enterprise Kubernetes clusters distribute computing nodes and stateful workloads across three separate physical Availability Zones within an AWS region (e.g. us-east-1a, us-east-1b, and us-east-1c). The following architectural blueprint illustrates the production multi-AZ topology:

`` [ External Internet Traffic / Route 53 DNS ] │ ▼ [ AWS Network Load Balancer (Cross-Zone Load Balancing Enabled) ] │ ├── Zone A: Private Subnet 1 ──► Ingress Controller Pod 1 ├── Zone B: Private Subnet 2 ──► Ingress Controller Pod 2 └── Zone C: Private Subnet 3 ──► Ingress Controller Pod 3 │ ┌─────────────────────────────┼─────────────────────────────┐ ▼ ▼ ▼ [ Worker Node Zone A ] [ Worker Node Zone B ] [ Worker Node Zone C ] ├── Pod Replica 1 ├── Pod Replica 2 ├── Pod Replica 3 ├── Cilium eBPF Agent ├── Cilium eBPF Agent ├── Cilium eBPF Agent └── Node Exporter └── Node Exporter └── Node Exporter │ │ │ └─────────────────────────────┴─────────────────────────────┘ │ (TopologySpreadConstraint: maxSkew 1) ▼ [ High-Availability Workload Quorum Maintained At All Times ] ``

Key topological pillars:

Multi-AZ Worker Distribution: Nodes are partitioned evenly across three availability zones. Autoscalers (such as Karpenter) are configured with zone diversification policies to prevent node concentration.
Control Plane Redundancy: AWS EKS manages control plane nodes across multiple AZs automatically, backed by etcd multi-leader consensus.
Cross-Zone Traffic Balancing: Network Load Balancers distribute incoming traffic evenly, while Kubernetes Topology Aware Hints keep inter-service traffic local to the same AZ to slash data transfer costs.

3. Production Workload Manifest: TopologySpreadConstraints, PDB & Resource Guarantees

The following production deployment manifest illustrates the battle-tested configuration required for high-concurrency microservices, featuring guaranteed QoS, TopologySpreadConstraints, readiness probes, and rootless container security:

production-deployment-manifest.yaml
yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: core-api-service
  namespace: production
  labels:
    app.kubernetes.io/name: core-api-service
    app.kubernetes.io/part-of: technofreaks-platform
spec:
  replicas: 6
  revisionHistoryLimit: 5
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 0 # Zero downtime during rolling updates
  selector:
    matchLabels:
      app: core-api-service
  template:
    metadata:
      labels:
        app: core-api-service
    spec:
      # Spread replicas evenly across AWS Availability Zones
      topologySpreadConstraints:
        - maxSkew: 1
          topologyKey: topology.kubernetes.io/zone
          whenUnsatisfiable: DoNotSchedule
          labelSelector:
            matchLabels:
              app: core-api-service
      # Enforce strict container security (PSS Restricted)
      securityContext:
        runAsNonRoot: true
        runAsUser: 10001
        runAsGroup: 10001
        fsGroup: 10001
        seccompProfile:
          type: RuntimeDefault
      containers:
        - name: application
          image: 111122223333.dkr.ecr.us-east-1.amazonaws.com/core-api:v2.4.1
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            capabilities:
              drop: ["ALL"]
          ports:
            - containerPort: 8080
              name: http
          # Guaranteed QoS: Memory requests EQUAL limits to prevent OOM eviction
          resources:
            requests:
              cpu: "1000m"
              memory: "2Gi"
            limits:
              memory: "2Gi"
              # CPU limit omitted to prevent CFS kernel throttling
          # Graceful termination hook to drain in-flight connections
          lifecycle:
            preStop:
              exec:
                command: ["/bin/sh", "-c", "sleep 10"]
          startupProbe:
            httpGet:
              path: /healthz/startup
              port: 8080
            failureThreshold: 30
            periodSeconds: 2
          readinessProbe:
            httpGet:
              path: /healthz/ready
              port: 8080
            periodSeconds: 5
          livenessProbe:
            httpGet:
              path: /healthz/live
              port: 8080
            periodSeconds: 10
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: core-api-service-pdb
  namespace: production
spec:
  minAvailable: 75%
  selector:
    matchLabels:
      app: core-api-service

4. Zero-Trust Network Policies & Pod Security Standards (PSS Restricted)

In a standard Kubernetes cluster, any pod can communicate with any other pod across namespaces. If an attacker compromises a public-facing frontend pod via an unpatched vulnerability, they can initiate internal lateral movement to query internal Redis caches, sensitive metadata endpoints (169.254.169.254), or relational databases.

Production clusters enforce Default-Deny Kubernetes NetworkPolicies powered by Cilium eBPF or Calico:

Default Deny Ingress & Egress: Every namespace drops all incoming and outgoing packets by default.
Explicit Egress Whitelisting: Pods are explicitly permitted to query only the CoreDNS cluster IP and their specific required database endpoints.
Metadata Server Blocking: All pods are strictly blocked from calling the AWS Instance Metadata Service (IMDSv2) IP address unless granted specific IRSA (IAM Roles for Service Accounts) identities.

In addition, namespace labels enforce Pod Security Standards (PSS) Restricted mode, automatically rejecting any manifest that attempts to mount host paths, run as root, or escalate Linux privileges.

5. Graceful Termination, PreStop Hooks & Zero-Downtime Rolling Deploys

During a rolling deployment, Kubernetes terminates old pods while starting new ones. However, there is an inherent race condition in how Kubernetes distributes termination events:

When a pod is scheduled for termination, two asynchronous events happen simultaneously: the container runtime sends a SIGTERM signal to the application process, and the kube-proxy / ingress controller updates iptables/eBPF endpoints to remove the pod from service load balancing. Because endpoint propagation across worker nodes takes 1 to 5 seconds, incoming client requests are still routed to the old pod after it has received SIGTERM, resulting in abrupt connection resets and HTTP 502 errors.

The solution is mandatory inclusion of a `preStop` sleep hook: sleep 10. The hook forces the application container to pause for 10 seconds before passing the SIGTERM signal to the application code. This gives ingress controllers and load balancers ample time to drain the endpoint from routing tables, ensuring zero dropped in-flight customer transactions.

Important Notice

Configuration Trap: Ensure your pod terminationGracePeriodSeconds (default 30s) is larger than the preStop sleep duration plus the application shutdown time (e.g. set to 45s).

6. Common Kubernetes Anti-Patterns & Troubleshooting Runbook

Platform teams frequently encounter several severe operational anti-patterns:

Blind CPU Limits (CFS Throttling): Setting strict limits.cpu invokes the Linux Completely Fair Scheduler (CFS) quota. When an application experiences a 5ms CPU burst, CFS violently throttles the process even if the underlying node has 80% idle CPU capacity, causing massive p99 latency spikes. Recommended practice: set realistic CPU requests, but omit CPU limits unless multi-tenancy noisy neighbors require hard capping.
Asymmetrical Memory Sizing: Setting memory limits significantly higher than requests creates an "overcommitted" node. When multiple pods surge simultaneously, the Linux kernel Out-Of-Memory (OOM) killer arbitrarily terminates innocent pods.
Missing PodDisruptionBudgets: Upgrading an EKS node group without PDBs drains all nodes concurrently, taking down all service replicas simultaneously.
Featured Resource & Solution

Our Kubernetes Consulting Services and [AWS Cost Optimization Guide](/blog/aws-eks-cost-optimization-15-ways-kubernetes-spend) help enterprises audit and eliminate these risks.

Kubernetes Consulting Services

7. Enterprise Kubernetes Production Readiness Checklist

Before promoting any application to production Kubernetes clusters, verify these five requirements:

1. Topology Spread Constraints: Confirm topologySpreadConstraints with maxSkew: 1 is configured across all Availability Zones.

2. PodDisruptionBudget: Verify a PDB enforcing at least minAvailable: 66% exists for every Deployment.

3. Guaranteed QoS Memory: Confirm memory requests equal memory limits to prevent sudden kernel OOM kills.

4. PreStop Grace Period: Ensure container lifecycle includes a sleep 10 preStop hook and appropriate termination grace period.

5. Non-Root User Enforcement: Verify securityContext.runAsNonRoot: true and read-only root filesystems are enforced.

Frequently Asked Questions

Why do CPU limits cause pod throttling even when node CPU usage is under 40%?▼

Kubernetes enforces CPU limits using Linux Completely Fair Scheduler (CFS) bandwidth quotas evaluated in 100-millisecond periods. If a single multi-threaded process consumes its quota within the first 15ms of a 100ms window, the kernel freezes the process for the remaining 85ms—even if the overall physical node has abundant idle CPU capacity. This is why enterprise Kubernetes architectures recommend setting CPU requests without hard CPU limits.

How do TopologySpreadConstraints differ from pod anti-affinity in Kubernetes?▼

Pod anti-affinity is a blunt binary constraint (either schedule or do not schedule on a matching failure domain), which often causes unschedulable pod states during auto-scaling. TopologySpreadConstraints provide fine-grained mathematical balance (maxSkew parameter), ensuring replicas are distributed evenly across Availability Zones or nodes while gracefully tolerating minor temporary imbalances.

What is the recommended strategy for graceful zero-downtime rolling updates in Kubernetes?▼

Set maxUnavailable: 0 and maxSurge: 25% (or 1) in your Deployment spec. Add a preStop sleep hook (sleep 10) to allow ingress controllers to remove the pod from routing tables before the app shuts down. Implement robust readiness probes that only return HTTP 200 once internal connection pools and caches are primed.

How do you implement zero-trust network segmentation in production Kubernetes?▼

Zero-trust network segmentation requires an eBPF-based CNI (such as Cilium) or Calico to enforce Kubernetes NetworkPolicies. Apply a default-deny ingress and egress policy to all application namespaces, explicitly whitelisting only necessary internal microservice endpoints, DNS servers, and external third-party APIs via domain-name (FQDN) policies.

SA
Sikander AliFounder & CEO • CKA

Founder & CEO | Principal Cloud Architect, TechnoFreaks

Kubernetes Orchestration Practice99.99% Uptime SLA • In-Kernel eBPF Observability

Scaling Kubernetes in Production? Eliminate Outages & Pod Restarts.

Our CNCF-certified Kubernetes administrators design and maintain resilient multi-AZ EKS and GKE clusters with automated Karpenter node autoscaling, Cilium eBPF networking, and ArgoCD GitOps delivery.

Implement This in Production

Ready to Upgrade Your Cloud Infrastructure?

Book a 30-minute technical architecture review with our senior DevOps leads to assess your migration roadmap and infrastructure optimization.