OpsCanary
kubernetesupgradesPractitioner

Zero-Downtime Migration of Kubernetes Deployments: The ExternalName Approach

5 min read CNCF BlogSep 3, 2026Reviewed for accuracy
Share
PractitionerHands-on experience recommended

In production environments, downtime can lead to significant losses. Migrating a critical deployment from the default namespace to a new one without any downtime is essential for maintaining service reliability. The ExternalName service in Kubernetes provides a clean solution to this problem, allowing you to redirect traffic to a new location while keeping existing consumers intact.

The process is straightforward. First, deploy your service in the new namespace. Then, convert the old Service object into an ExternalName service. This service will point to the new deployment's DNS name. For example, you can define the service like this:

YAML
1apiVersion: v1
2kind: Service
3metadata:
4  name: auth-svc
5  namespace: default
6spec:
7  type: ExternalName
8  externalName: auth-svc.authentication.svc.cluster.local

With this setup, any consumer still calling auth-svc.default.svc.cluster.local will be silently redirected to the new service in the authentication namespace. Additionally, you may need to annotate the new namespace to bypass duplicate ingress checks during the migration:

YAML
1apiVersion: v1
2kind: Namespace
3metadata:
4  name: authentication
5  annotations:
6    policy.example.com/allow-duplicate-ingress: "true"

In practice, this method works best when all components interact with services through their DNS names rather than hardcoded IPs or ClusterIPs. Be aware that if any part of your application relies on static IPs, this approach will not be effective. Always test thoroughly in a staging environment before proceeding with production migrations.

Key takeaways

  • Leverage ExternalName services to redirect traffic without downtime.
  • Deploy the new service in a separate namespace before migration.
  • Annotate the new namespace to allow duplicate ingress during migration.

Why it matters

In production, maintaining uptime during migrations is critical for user satisfaction and operational stability. This approach minimizes risk and ensures continuity of service.

Code examples

YAML
1apiVersion: v1
2kind: Service
3metadata:
4  name: auth-svc
5  namespace: default
6spec:
7  type: ExternalName
8  externalName: auth-svc.authentication.svc.cluster.local
YAML
1apiVersion: v1
2kind: Namespace
3metadata:
4  name: authentication
5  annotations:
6    policy.example.com/allow-duplicate-ingress: "true"

When NOT to use this

This only works cleanly because everything here talked to auth-svc through its DNS name rather than a hardcoded IP or ClusterIP. If your architecture relies on static IPs, consider alternative migration strategies.

Want the complete reference?

Read official docs

Test what you just learned

Quiz questions written from this article

Take the quiz →
Linux FoundationSponsor

Industry-standard certifications built by the people behind Linux and Kubernetes. Earn the CKA — the gold standard Kubernetes administrator cert. OpsCanary readers get 30% off year-round with code OPSCANARY3.

Get CKA certified →

Get the daily digest

One email. 5 articles. Every morning.

No spam. Unsubscribe anytime.