DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • The State of Kubernetes: Self-Managed vs. Managed Platforms
  • Implementing a Self-Healing Infrastructure With Kubernetes and Prometheus
  • Can You Run a MariaDB Cluster on a $150 Kubernetes Lab? I Gave It a Shot
  • How Kubernetes Cluster Sizing Affects Performance and Cost Efficiency in Cloud Deployments

Trending

  • Build Self-Managing Data Pipelines With an LLM Agent
  • From Data Movement to Local Intelligence: The Shift from Centralized to Federated AI
  • Throughput vs Goodput: The Performance Metric You Are Probably Ignoring in LLM Testing
  • Stop Writing Dialect-Specific SQL: A Unified Query Builder for Node.js
  1. DZone
  2. Software Design and Architecture
  3. Containers
  4. Achieving Container High Availability in EKS, AKS, and RKS: A Comprehensive Guide

Achieving Container High Availability in EKS, AKS, and RKS: A Comprehensive Guide

High Availability (HA) ensures Kubernetes workloads stay operational during failures or traffic spikes, and platforms like EKS, AKS, and RKS simplify its implementation.

By 
Sai Sandeep Ogety user avatar
Sai Sandeep Ogety
DZone Core CORE ·
Nov. 27, 24 · Tutorial
Likes (29)
Comment
Save
Tweet
Share
5.1K Views

Join the DZone community and get the full member experience.

Join For Free

In today’s cloud-native ecosystem, ensuring High Availability (HA) is a critical requirement for containerized applications running on Kubernetes. HA ensures that your workloads remain operational even in the face of failures, outages, or traffic spikes. Platforms like Amazon Elastic Kubernetes Service (EKS), Azure Kubernetes Service (AKS), and Red Hat Kubernetes Service (RKS) provide managed Kubernetes solutions that simplify cluster management, but achieving true HA requires careful configuration and planning.

This article offers a comprehensive guide to setting up HA in EKS, AKS, and RKS, covering foundational concepts, platform-specific configurations, and advanced features like Horizontal Pod Autoscaler (HPA). With actionable examples and best practices, this guide equips you to build resilient, production-grade Kubernetes environments.

What Is High Availability in Kubernetes?

High Availability (HA) refers to the ability of a system to remain operational even during hardware failures, software crashes, or unexpected traffic surges. Kubernetes inherently supports HA with features like pod replication, self-healing, and autoscaling, but managed platforms like EKS, AKS, and RKS offer additional features that simplify achieving HA.

Core Principles of High Availability

  1. Multi-Zone Deployments: Spread workloads across multiple availability zones to avoid single points of failure.
  2. Self-Healing: Automatically replace failed pods and nodes.
  3. Horizontal Pod Autoscaler (HPA): Dynamically scale workloads based on demand.
  4. Stateful Resilience: Ensure stateful workloads use reliable persistent storage.
  5. Disaster Recovery: Plan for cross-region failover to mitigate regional outages.

High Availability in EKS (Amazon Elastic Kubernetes Service)

Amazon EKS integrates seamlessly with AWS infrastructure to deliver HA. Here’s how to configure it:

Step 1: Multi-Zone Deployment

Deploy worker nodes across multiple availability zones during cluster creation:

YAML
 
eksctl create cluster \
  --name my-cluster \
  --region us-west-2 \
  --zones us-west-2a,us-west-2b,us-west-2c \
  --nodegroup-name standard-workers


Step 2: Stateful Application Resilience

Use Amazon Elastic Block Store (EBS) for persistent storage:

YAML
 
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ebs-claim
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi


Step 3: Horizontal Pod Autoscaler (HPA) in EKS

Enable the Metrics Server to use HPA:

YAML
 
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml


Define an HPA resource for your workload:

YAML
 
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: nginx-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: nginx-deployment
  minReplicas: 2
  maxReplicas: 10
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 50


Step 4: Disaster Recovery

Configure multi-region failover with AWS Route 53. Use latency-based DNS routing to direct traffic to healthy clusters across regions.

High Availability in AKS (Azure Kubernetes Service)

Azure Kubernetes Service offers features like Availability Zones and seamless integration with Azure’s ecosystem.

Step 1: Multi-Zone Configuration

Deploy AKS with zone-redundant nodes:

YAML
 
az aks create \
  --resource-group myResourceGroup \
  --name myAKSCluster \
  --location eastus \
  --node-count 3 \
  --enable-cluster-autoscaler \
  --zones 1 2 3


Step 2: Resilient Networking

Leverage Azure Application Gateway for highly available Ingress:

YAML
 
az network application-gateway create \
  --resource-group myResourceGroup \
  --name myAppGateway \
  --capacity 2


Step 3: Horizontal Pod Autoscaler in AKS

HPA is pre-configured in AKS. Define an HPA resource similar to EKS. Combine it with the Cluster Autoscaler:

YAML
 
az aks update \
  --resource-group myResourceGroup \
  --name myAKSCluster \
  --enable-cluster-autoscaler


Step 4: Stateful Workloads

Use Azure Disk for resilient storage:

YAML
 
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: azure-disk-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  storageClassName: managed-premium


High Availability in RKS (Red Hat Kubernetes Service)

RKS, based on OpenShift, provides robust HA features through Operators and advanced cluster management.

Step 1: Multi-Zone Deployment

Distribute worker nodes across zones:

YAML
 
openshift-install create cluster --zones us-west-2a,us-west-2b


Step 2: Stateful Applications

Use OpenShift Container Storage (OCS) for persistent data storage:

YAML
 
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ocs-claim
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 20Gi


Step 3: Horizontal Pod Autoscaler in RKS

OpenShift natively supports HPA. Deploy a sample configuration as shown earlier and monitor scaling behavior using OpenShift’s built-in dashboards.

Best Practices for High Availability

Set Realistic Resource Limits

Configure CPU and memory requests/limits to avoid resource contention.

YAML
 
resources:
  requests:
    cpu: 500m
    memory: 512Mi
  limits:
    cpu: 1
    memory: 1Gi


Enable Proactive Monitoring

Use tools like Prometheus and Grafana to track pod scaling, node health, and resource utilization.

Test Failover Scenarios

Regularly simulate zone or region failures to validate disaster recovery configurations.

Combine HPA With Cluster Autoscaler

Ensure the cluster can scale nodes when HPA scales pods beyond current capacity.

Optimize Costs

Use spot instances for non-critical workloads and configure autoscalers to scale down during low-traffic periods.

Conclusion

Achieving container high availability in EKS, AKS, and RKS requires a blend of platform-specific configurations, best practices, and advanced Kubernetes features like HPA. By following this guide, you can build resilient, scalable, and cost-efficient Kubernetes environments that are ready for production.

HA is more than just uptime — it’s about delivering trust, performance, and reliability to your users. Start implementing these strategies today to elevate your Kubernetes deployments to the next level.

Kubernetes cluster Container

Opinions expressed by DZone contributors are their own.

Related

  • The State of Kubernetes: Self-Managed vs. Managed Platforms
  • Implementing a Self-Healing Infrastructure With Kubernetes and Prometheus
  • Can You Run a MariaDB Cluster on a $150 Kubernetes Lab? I Gave It a Shot
  • How Kubernetes Cluster Sizing Affects Performance and Cost Efficiency in Cloud Deployments

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook