A production application running on Azure Kubernetes Service (AKS) may need maintenance without interrupting customers. The platform team might need to upgrade Kubernetes, replace node pools, change network configurations, update ingress components, or migrate workloads to a different cluster.
The challenge is that maintenance should not require customers to stop using the application.
Consider an e-commerce application running in two AKS clusters. The primary cluster handles customer requests, while the secondary cluster contains the same application and is ready to receive traffic. The engineering team needs to upgrade the primary cluster, but it cannot simply shut down the application and ask customers to wait.
A better approach is to move application traffic to the secondary cluster, perform maintenance on the primary cluster, validate the updated environment, and then decide whether to move traffic back.
This process is often called traffic shifting or traffic migration. It separates application availability from the maintenance activities happening inside an individual Kubernetes cluster.
Azure provides several ways to implement this architecture. Azure Front Door supports global HTTP and HTTPS traffic routing, while Azure Traffic Manager provides DNS-based routing. Kubernetes ingress controllers and service meshes can also control traffic within or between clusters, depending on the architecture.
This article explains how to prepare multiple AKS clusters for maintenance, choose an appropriate traffic-routing strategy, shift traffic safely, validate the destination cluster, and move traffic back without creating unnecessary downtime.
Why Traffic Should Be Managed Separately From Cluster Maintenance
Kubernetes clusters contain several components that may need maintenance independently of the application.
For example, an AKS maintenance activity may involve:
- Upgrading the Kubernetes control plane.
- Updating node operating system images.
- Replacing an existing node pool.
- Changing the cluster's network configuration.
- Updating ingress controllers.
- Applying security patches.
- Modifying cluster-level policies.
Some operations can be performed while workloads continue running. However, certain changes can temporarily affect pod availability, networking, or application connectivity.
If all customer traffic depends on one cluster, even a planned maintenance operation can become a service interruption.
Running the application in multiple clusters provides another option. Instead of depending on one cluster during maintenance, the organization can direct traffic to another healthy cluster.
A typical architecture looks like this:
Customers
|
v
Global Traffic Router
Azure Front Door
|
+--------+--------+
| |
v v
AKS Cluster A AKS Cluster B
Primary Secondary
| |
Application Application
Workloads Workloads
| |
+--------+--------+
|
Shared or Replicated
Data Services
The global traffic router determines which cluster receives incoming requests.
When Cluster A requires maintenance, traffic can be moved to Cluster B. Cluster A can then be upgraded without remaining in the active request path.
However, having two clusters is not enough. Both clusters must be capable of serving the application, their dependencies must be available, and the routing layer must be configured to move traffic safely.
Choosing a Traffic-Routing Strategy
The first architectural decision is selecting how traffic will move between clusters.
The choice depends on the application protocol, required failover speed, traffic-control requirements, and whether the application uses an active-active or active-passive deployment model.
Azure Front Door
<text>Azure Front Door</text> is a global Layer 7 application delivery service that routes HTTP and HTTPS requests to configured origins.
In a multi-cluster AKS architecture, each cluster can have a regional ingress endpoint, such as Azure Application Gateway, registered as an origin in Azure Front Door.
The application has one public entry point, while Front Door decides which regional endpoint receives each request.
Front Door supports several routing approaches:
- Priority-based routing for primary and secondary environments.
- Weighted routing for gradual traffic distribution.
- Latency-based routing for directing users toward suitable origins.
- Health probes for detecting unhealthy origins.
This makes Front Door a good choice for web applications and APIs that need controlled traffic movement between clusters.
For example, the primary cluster can receive all normal traffic. During maintenance, the platform team can disable the primary origin or change its routing configuration so that requests go to the secondary cluster.
Front Door can also support gradual traffic movement, such as sending a small percentage of requests to the destination cluster before increasing its share.
Azure Traffic Manager
Azure Traffic Manager is a DNS-based traffic-routing service.
Instead of proxying every application request, Traffic Manager responds to DNS queries with the endpoint selected by its routing method.
It supports routing methods such as:
- Priority.
- Weighted.
- Performance.
- Geographic.
- Subnet.
For example, a priority-based profile can direct users to the primary cluster while keeping the secondary cluster available as a backup.
When the primary endpoint becomes unhealthy, Traffic Manager can return the secondary endpoint in DNS responses.
There is an important difference between Traffic Manager and Front Door. Traffic Manager does not process application requests. It controls DNS resolution, so clients and DNS resolvers may continue using previously cached answers until their DNS cache entries expire.
This can make traffic movement less immediate than request-level routing through Front Door.
Kubernetes ingress controllers
An ingress controller can route requests to services inside a Kubernetes cluster.
For example, NGINX Ingress or another supported ingress implementation can route requests to different application services based on hostnames and paths.
Ingress controllers are useful for managing traffic within a cluster. However, when moving traffic between completely separate clusters, an additional global routing mechanism is generally required.
An ingress controller in Cluster A does not automatically control the ingress controller in Cluster B.
Service mesh routing
A service mesh can provide more advanced traffic management between services.
For example, an architecture using a multi-cluster service mesh may support weighted traffic distribution, canary releases, and service-to-service communication across clusters.
However, a service mesh introduces additional components and operational responsibilities. It should be selected when the application needs those capabilities, not simply because two clusters exist.
Comparing the options
Routing solution | Routing level | Traffic control | Suitable scenario |
|---|
Azure Front Door | HTTP/HTTPS request level | Priority, weight, latency, health | Global web applications and APIs |
Azure Traffic Manager | DNS level | Priority, weight, geography, performance | Multi-region DNS-based routing |
Kubernetes ingress | Cluster ingress level | Host and path routing | Routing within a cluster |
Service mesh | Service communication level | Advanced service traffic policies | Complex microservice environments |
For a typical multi-region AKS web application, Azure Front Door is a strong choice when the organization needs a central HTTP/HTTPS entry point and controlled routing between clusters.
Preparing Both Clusters Before Maintenance
Before moving traffic, the destination cluster must be ready to handle customer requests.
This is one of the most important parts of the process. Sending traffic to a cluster that contains only part of the application can cause failures even when the cluster itself reports healthy nodes.
Suppose the application contains:
- frontend-service
- order-service
- payment-service
- inventory-service
All required services should be deployed and available in both clusters before the traffic shift begins.
The destination cluster also needs access to the required dependencies.
For example, it may need:
- Database connectivity.
- Cache connectivity.
- Message broker access.
- Object storage access.
- Secrets and certificates.
- External API access.
- Identity and authentication services.
The application configuration should be consistent between the clusters, except for settings that are intentionally region-specific.
Deploy the application to both clusters
Use the same container image and Kubernetes manifests wherever possible.
For example, the deployment should use an immutable image tag or digest:
apiVersion: apps/v1
kind: Deployment
metadata:
name: order-service
namespace: production
spec:
replicas: 3
selector:
matchLabels:
app: order-service
template:
metadata:
labels:
app: order-service
spec:
containers:
- name: order-service
image: myregistry.azurecr.io/order-service:v2.4.0
ports:
- containerPort: 8080
readinessProbe:
httpGet:
path: /health/ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
httpGet:
path: /health/live
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
Apply the same deployment to both clusters using separate Kubernetes contexts:
kubectl --context aks-cluster-a apply -f order-service.yaml
kubectl --context aks-cluster-b apply -f order-service.yaml
The readiness probe is particularly important. It tells Kubernetes when the application is ready to receive traffic.
A running container is not necessarily ready to serve requests. The application might still be loading configuration, establishing database connections, or initializing dependencies.
The readiness endpoint should check the conditions required for the application to serve requests. It should not report healthy simply because the process is running.
Verify the destination cluster
Before moving traffic, check the workloads in Cluster B:
kubectl --context aks-cluster-b get nodes
kubectl --context aks-cluster-b get pods -n production
kubectl --context aks-cluster-b get services -n production
Check the deployment status:
kubectl --context aks-cluster-b rollout status \
deployment/order-service \
-n production
Verify the application through its regional ingress endpoint.
For example, send a request to the health endpoint exposed by the destination cluster:
curl -i https://cluster-b.example.com/health/ready
A successful response confirms that the endpoint is reachable and the application reports readiness. It does not prove that every business operation will succeed, so test the important application workflows as well.
Moving Traffic With Azure Front Door
Azure Front Door provides a practical way to move web application traffic between separate AKS clusters.
A typical architecture has one Front Door profile, an origin group, and multiple regional origins.
For example:
Origin | Target | Normal role |
|---|
origin-cluster-a | Regional ingress for Cluster A | Primary |
origin-cluster-b | Regional ingress for Cluster B | Secondary |
The origin group contains the regional endpoints and the health-probe configuration.
During normal operations, Cluster A receives traffic. Cluster B remains available as the destination for maintenance.
Configure health probes
Front Door uses health probes to evaluate whether an origin is healthy.
The probe should target an endpoint that verifies whether the application can serve requests.
For example:
https://cluster-a.example.com/health/ready
https://cluster-b.example.com/health/ready
The readiness endpoint should not return success when critical dependencies are unavailable.
For example, if the order service cannot connect to its database, returning a healthy response could cause Front Door to continue routing customer requests to an application that cannot complete orders.
However, health endpoints should also be designed carefully. If every optional dependency is included in the readiness check, a temporary failure in a noncritical component might remove an otherwise usable cluster from traffic.
The health check should represent the application's ability to perform the operations required by its users.
Use priority-based routing
Priority-based routing is appropriate when one cluster normally serves all traffic and another cluster acts as a standby.
For example:
Origin | Priority |
|---|
Cluster A | 1 |
Cluster B | 2 |
A lower priority number represents a higher preference.
When Cluster A is healthy, Front Door selects it according to the configured routing behavior. If it becomes unavailable, Front Door can route requests to Cluster B.
This model is useful for planned maintenance because the platform team can remove the primary origin from rotation before beginning the maintenance operation.
Use weighted routing for gradual traffic movement
Weighted routing is useful when the platform team wants to move traffic progressively.
For example, suppose Cluster A is the current production cluster and Cluster B is the destination.
A maintenance migration could use the following sequence:
Stage | Cluster A weight | Cluster B weight |
|---|
Initial | 100 | 0 |
Initial validation | 95 | 5 |
Expanded validation | 75 | 25 |
Majority traffic | 25 | 75 |
Final cutover | 0 | 100 |
These weights describe the intended traffic distribution, not a guarantee that every group of requests will be divided in exactly those percentages. Actual distribution can vary according to the routing configuration and request patterns.
Weighted routing is useful when the application can safely serve traffic from both clusters simultaneously.
For stateful applications, ensure that both clusters can work with the same authoritative data and that simultaneous writes do not create conflicts.
A Practical Maintenance Traffic-Shift Procedure
Consider a production environment with two AKS clusters.
Cluster A is currently serving all customer traffic. Cluster B contains the same application and is ready for maintenance traffic.
The goal is to upgrade Cluster A without interrupting customers.
A safe procedure can be divided into several stages.
Stage 1: Validate the destination cluster
Before changing the routing configuration, confirm that Cluster B is ready.
Check the following:
- All required deployments are available.
- Readiness probes are successful.
- Database connections work.
- Authentication works.
- Payment and order workflows work.
- Required secrets and certificates are available.
- The cluster has sufficient capacity for the expected traffic.
If Cluster B is not ready, do not start the traffic migration.
Stage 2: Send a small amount of traffic to Cluster B
If the application supports simultaneous operation across clusters, begin with a small traffic percentage.
For example, configure the routing layer to send approximately five percent of traffic to Cluster B.
Monitor:
- HTTP 5xx responses.
- Request latency.
- Application exceptions.
- Database errors.
- Connection failures.
- CPU and memory usage.
- Queue processing delays.
The purpose of this stage is to verify that the destination cluster behaves correctly under real application traffic.
A successful health probe is useful, but it cannot replace real workload validation.
Stage 3: Increase traffic gradually
If the initial traffic behaves correctly, increase the destination cluster's share.
For example, move from five percent to 25 percent and then to 75 percent.
At each stage, observe the application for a period appropriate to its workload and risk level.
Avoid increasing traffic immediately after a single successful request. A problem may appear only when the cluster receives a larger number of concurrent requests.
Stage 4: Move all new traffic to Cluster B
Once the destination cluster has demonstrated stable behavior, move all new traffic to Cluster B.
At this point, Cluster A should no longer be receiving new application requests through the global routing layer.
However, do not immediately terminate existing connections or stop the application. Some clients may still have active requests, long-running operations, or persistent connections.
Allow existing requests to complete according to the application's connection and request-timeout behavior.
Stage 5: Perform maintenance on Cluster A
After traffic has moved and the application team has confirmed that Cluster A is no longer serving active requests, begin maintenance.
For example:
az aks upgrade \
--resource-group aks-production-rg \
--name aks-cluster-a \
--kubernetes-version <supported-version>
The target version must be supported by the cluster and available in the region.
The maintenance operation should be performed according to the cluster's upgrade plan. Review node-pool compatibility, workload disruption, PodDisruptionBudgets, and application-specific dependencies before proceeding.
Stage 6: Validate Cluster A after maintenance
When the upgrade completes, verify the cluster:
kubectl --context aks-cluster-a get nodes
kubectl --context aks-cluster-a get pods -A
Check the important deployments:
kubectl --context aks-cluster-a rollout status \
deployment/order-service \
-n production
Test the application through Cluster A's regional endpoint.
Do not move traffic back until the cluster and its application dependencies have passed the required checks.
Stage 7: Decide whether to move traffic back
After maintenance, the platform team can either keep Cluster B active or move traffic back to Cluster A.
If the original cluster is intended to remain primary, gradually shift traffic back using the same validation process.
For example:
Cluster B: 100% -> Cluster A: 0%
Cluster B: 75% -> Cluster A: 25%
Cluster B: 25% -> Cluster A: 75%
Cluster B: 0% -> Cluster A: 100%
This gives the engineering team an opportunity to detect problems introduced by the maintenance operation before all customer traffic returns.
Using Azure Traffic Manager for Cluster Switching
Azure Traffic Manager can also direct traffic between multiple AKS clusters.
For example, the application may expose a regional public endpoint for each cluster:
Cluster A: 20.10.10.10
Cluster B: 20.20.20.20
Each endpoint can be registered in a Traffic Manager profile.
A priority-based configuration can direct users to Cluster A under normal conditions and use Cluster B as the fallback.
A weighted configuration can distribute DNS responses between the two endpoints.
However, Traffic Manager works through DNS responses rather than proxying application requests.
This has an important operational consequence.
Changing an endpoint's weight or status does not guarantee that every client immediately connects to the new cluster. DNS resolvers and clients can cache the previous response until the relevant TTL expires.
For planned maintenance, this behavior should be tested before the maintenance window.
Traffic Manager can be a suitable choice for multi-protocol routing and DNS-based failover, while Front Door is generally more convenient when the application requires HTTP request-level routing and a centralized web entry point.
Handling Existing Connections and Long-Running Requests
Changing the routing configuration usually affects new traffic. It does not necessarily terminate connections that have already been established.
This is especially important for applications using:
- WebSockets.
- Server-Sent Events.
- Long-running HTTP requests.
- Large file uploads and downloads.
- Streaming responses.
- Persistent connections.
For example, a customer might be uploading a large file when the platform team starts maintenance.
If the original cluster is shut down immediately after traffic shifting, the upload may fail even though new requests are successfully reaching the destination cluster.
A safer procedure is to stop admitting new work to the old cluster, wait for active requests to complete, and use application-level shutdown behavior where necessary.
Kubernetes provides termination controls for pods, including terminationGracePeriodSeconds and preStop hooks.
For example:
apiVersion: apps/v1
kind: Deployment
metadata:
name: order-service
spec:
replicas: 3
selector:
matchLabels:
app: order-service
template:
metadata:
labels:
app: order-service
spec:
terminationGracePeriodSeconds: 60
containers:
- name: order-service
image: myregistry.azurecr.io/order-service:v2.4.0
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -c
- sleep 10
This example provides a termination grace period and a short preStop delay.
It is not a complete connection-draining implementation. The application must also stop accepting new work and allow existing requests to finish within the configured shutdown window.
For long-running connections, the application may need to support reconnection and recovery at the client level.
The Data Consistency Problem During Cluster Switching
Traffic migration becomes more complicated when both clusters write to the same business data.
Consider an application that processes orders.
Cluster A and Cluster B both run the order-service, but they also connect to a database.
If both clusters write to independent databases without a synchronization strategy, customers may see different order information depending on which cluster receives their requests.
For example:
- A customer creates an order through Cluster A.
- Traffic moves to Cluster B.
- The customer checks the order through Cluster B.
- Cluster B cannot find the order because its database has not received the update.
This is not a traffic-routing failure. It is a data consistency problem.
Before using multiple clusters for maintenance traffic shifting, define how application state is managed.
Common approaches include:
- Both clusters connect to the same authoritative database.
- Database replication keeps the destination cluster's data synchronized.
- A database service provides multi-region capabilities with a clearly defined consistency model.
- Writes are temporarily restricted during a controlled cutover when the application cannot safely support simultaneous writes.
For many transactional applications, using one authoritative database during maintenance is simpler than allowing two independent databases to accept writes.
However, the database itself must remain reachable from both clusters, and its availability must be included in the maintenance plan.
Also remember that moving HTTP traffic does not automatically move queues, background jobs, scheduled tasks, or message consumers. These components need their own coordination strategy to prevent duplicate processing.
Monitoring the Traffic Shift
A traffic migration should be treated as an operational change with measurable success criteria.
The team should monitor both the routing layer and the application.
Useful metrics include:
Metric | What it helps identify |
|---|
Request count by cluster | Whether traffic is reaching the intended destination |
HTTP 4xx and 5xx responses | Application and client-facing errors |
Request latency | Whether the destination cluster is slower |
Pod readiness | Whether application instances are available |
CPU and memory utilization | Whether the destination has enough capacity |
Database connection errors | Whether dependencies are reachable |
Queue processing delay | Whether background workloads are keeping up |
Active connections | Whether old requests are still using the source cluster |
For example, if Cluster B receives more traffic but its HTTP 5xx rate increases sharply, stop the traffic expansion and investigate.
The platform team should also monitor the origin health reported by Front Door or the endpoint health reported by Traffic Manager.
A successful routing change is not the same as a successful application migration. The application must continue processing real requests correctly.
Planning a Rollback Before Starting Maintenance
Every traffic migration should have a rollback plan.
Suppose Cluster B receives 25 percent of production traffic and starts returning unexpected payment errors.
The team should be able to reduce its traffic share or remove it from the routing configuration without waiting for a new deployment.
A rollback procedure should define:
- Which metrics trigger a rollback.
- Who can approve the rollback.
- How traffic will be returned to the previous cluster.
- Whether the source cluster is still healthy.
- How requests and data changes made during the migration will be handled.
- How the team will validate recovery.
For Front Door, this may involve changing the origin weights or disabling an unhealthy origin.
For Traffic Manager, it may involve restoring the original endpoint priorities or weights, while accounting for DNS caching.
The rollback should be tested before the maintenance window. A procedure that has never been executed is not a reliable recovery plan.
One important limitation is that traffic rollback does not reverse data changes already made by the destination cluster. If both clusters were accepting writes, the application must preserve data consistency during rollback.
Production Checklist for Cluster Maintenance
Before moving production traffic, review the following items:
- The destination cluster is deployed and healthy.
- Required application versions are available in both clusters.
- Secrets, certificates, and configuration are synchronized.
- Database and external service connectivity has been tested.
- Readiness and health probes reflect real application availability.
- The global traffic router has both cluster endpoints configured.
- Traffic weights or priorities have been verified.
- Long-running requests and persistent connections have a drain strategy.
- Background jobs and message consumers are coordinated.
- Monitoring dashboards are available for both clusters.
- Rollback conditions and responsibilities are documented.
- The team has tested the traffic-switching procedure.
This checklist should be part of the maintenance runbook rather than something assembled during an incident.
Conclusion
Moving application traffic between Kubernetes clusters allows platform teams to perform maintenance without depending on a single cluster to remain available throughout the operation.
Azure Front Door provides request-level routing for HTTP and HTTPS applications, while Azure Traffic Manager provides DNS-based routing across regional endpoints. Both can support maintenance traffic shifts, but they have different behaviors and failover characteristics.
The safest approach is to prepare the destination cluster first, verify application dependencies, move traffic gradually when the architecture supports it, and monitor real application behavior at every stage. Once traffic has moved away from the source cluster and active connections have been handled, maintenance can begin.
The data layer deserves equal attention. Multiple clusters do not automatically share application state, database writes, or background processing. Those components need their own consistency and coordination strategy.
A reliable maintenance process therefore combines traffic routing, application readiness, connection draining, data consistency, monitoring, and rollback planning. When these parts are designed together, Kubernetes cluster maintenance becomes a controlled operational activity rather than an unexpected customer-facing interruption.
Join the conversation! Your thoughts help the community grow.