High availability takes more than failover
High Availability (HA) is easy to put on an architecture diagram and much harder to deliver. Three application replicas, a Kubernetes cluster, two load balancers and a replicated database can look like a complete solution. Yet a failed network link, a storage outage, a power cut or another shared dependency can bring the whole system down.
High availability is the ability of the whole system to keep delivering the required level of service through the failures it was designed to withstand. What matters is how the system performs under load and whether it behaves predictably while something is failing.
Where to look for single points of failure
Start by identifying your critical components and dependencies. A single point of failure (SPOF) can appear at any layer:
- Physical infrastructure – one data centre, a shared power supply, a single UPS or cooling with no redundancy.
- Network – one internet provider, a single router or switch, or links that share the same physical route.
- Virtualisation – several virtual machines running on one physical host.
- Platform – a single Kubernetes node, a shared storage layer or a single entry point to the service.
- Application and data – a single application instance, a database with no redundancy, a queue or an authentication service the whole system relies on.
Redundancy helps when one failed dependency cannot take down every copy. Two instances on the same power circuit go down together when that circuit fails. Three application replicas have the same problem if they all depend on a storage system that has just stopped responding.
Statelessness makes replication easier
The application layer is easiest to replicate when it is stateless. Any instance can handle the next request without relying on a particular process's memory, a local disk or a specific server.
Sessions, persistent data and job state should live in external systems designed for the purpose. That way, losing a pod or a server does not mean losing the context the application needs.
Databases and queues hold state by design. They need their own redundancy, replication and recovery mechanisms. Statelessness makes it easier to replicate the application. Service availability still depends on whether its critical dependencies survive.
HA across the infrastructure stack
On premises, responsibility for availability starts with the physical infrastructure. Two power supplies in a server will do little good if both use the same failed circuit. Two internet links can also fail together if they share the provider's infrastructure.
When designing for redundancy, account for power feeds, UPS units, network links, edge devices, virtualisation hosts and storage systems. If the system must withstand the loss of an entire data centre, plan for a separate site.
Three virtual machines on one host share a single failure domain at the host level. Likewise, redundant hosts will do little good if a shared datastore fails and stops every virtual machine.
Kubernetes on premises
Kubernetes makes it easier to run multiple replicas, but you still have to decide where they run. In practice, that means considering topology spread constraints (topologySpreadConstraints) or anti-affinity rules, readiness probes, PodDisruptionBudget, resource limits and spare capacity.[1][2]
Three replicas on one node go down with that node. A PodDisruptionBudget limits voluntary pod evictions made through the Eviction API, for example during a node drain. A node failure can take pods down regardless of that budget.[2]
On premises, we often use HAProxy with virtual IP addresses (VIPs) that can move between instances. Check how long it takes to detect the failure and take over the address, how ARP tables update on IPv4 networks, whether the backends are healthy, and how the network and power supply hold up. The VIP gives you an entry point. Whether the request succeeds still depends on the application and its dependencies.
Kubernetes on Google Cloud
On Google Cloud (GCP), we can use regional GKE clusters, load balancers, autoscaling and managed services. A regional GKE cluster replicates its control plane across zones in one region. For the application to survive the loss of a zone, replicas need to be spread appropriately and the remaining zones need enough capacity. Databases, storage, DNS and external services need to hold up too.[3]
If the system must withstand the loss of an entire region, it needs a plan involving another region. The cloud changes who is responsible for parts of the infrastructure. You still have to design for application and data resilience.
Databases and storage
The data layer is often the hardest part of designing for high availability. Starting another database instance is only the beginning.
Synchronous replication can offer stronger protection for committed transactions, but it can also make writes slower and depend on the availability of the required replicas. Asynchronous replication lets the primary commit without waiting for a replica. If the primary fails, the most recent changes may be missing.[4]
During failover, you have to choose the right replica, preserve data consistency, transfer writes safely and let the application reconnect. Limit retry attempts, space them out with backoff and add jitter so they do not all happen at once. Protect business operations that cannot safely run twice — for example by making them idempotent.[5]
Starting a replacement pod does not guarantee that its volume will be available on another node. Account for redundancy in the storage system, access paths and controllers, and plan how to recover the data.
An accidental deletion or a logical error can propagate to every replica. Keep backups alongside replication and test that you can restore them.
Capacity and performance after a failure
A system that still responds after losing a node, but takes ten times as long, can be effectively unavailable to users. Plan capacity for failure as well as for normal operation.
If you need four nodes to handle the usual load, losing one of those four can overload the rest. In an N+1 setup, a fifth equivalent node provides spare capacity for the loss of one node, provided the remaining nodes can take over its workload.
Autoscaling helps, but new pods and nodes take time to start. The bottleneck may turn out to be a database, storage, a queue or an external API.
Alongside CPU and memory, track p95 and p99 response times, errors, timeouts, queue lengths, connection pool usage and storage performance.
Cascading failures are particularly dangerous. Losing one component increases the load on the rest. They respond more slowly, so clients retry. Traffic rises and the failure can spread to the whole system. Concurrency limits, connection limits, timeouts, controlled retries and circuit breakers can help contain it.[5]
Monitoring, testing and measurable requirements
The configuration tells you what the system should do when something fails. Regular tests tell you what it actually does under load.
Monitoring should cover infrastructure, the platform, dependencies, the application and actual business operations. A pod in the Ready state or an HTTP 200 response tells you very little about whether a user can complete what they came to do.
Test what happens when you lose a Kubernetes node, a virtualisation host, a network link, the active HAProxy instance, a database instance or access to storage. If your GKE architecture is meant to survive the loss of a zone, test that too. For each test, measure how long detection and failover take, how much data is lost, how many errors users see and how long it takes to get back to full performance.
Start with measurable requirements:[6]
- SLO (service level objective) – a target for service performance, such as availability over a defined period. An SLA (service level agreement) sets out the commitments agreed with the service recipient.
- RTO (recovery time objective) – the target for the maximum time it should take to restore service after a disruption.
- RPO (recovery point objective) – the acceptable amount of data loss expressed in time, such as up to five minutes of changes.
HA limits the impact of failures the system is designed to withstand during normal operation. Disaster recovery (DR) covers restoring service after more severe events, such as losing a data centre or region. Both need to be planned and tested.[6]
Summary
High availability is a property of the whole system. It starts with power and networking, extends through virtualisation, storage, the application and the database, and is put to the test when something fails.
The system has to keep delivering the required service, handle the load and meet its data consistency requirements. If it works only when every component is healthy, it simply hasn't had the right failure yet.
