Network considerations
Review the strategies for redirecting your application network traffic after migration.
DNS considerations
The DNS domain of the target cluster is different from the domain of the source cluster. By default, applications get FQDNs of the target cluster after migration.
To preserve the source DNS domain of migrated applications, select one of the two options described below.
Isolating the DNS domain of the target cluster from the clients
You can allow the clients’ requests sent to the DNS domain of the source cluster to reach the DNS domain of the target cluster without exposing the target cluster to the clients.
Procedure
Place an exterior network component, such as an application load balancer or a reverse proxy, between the clients and the target cluster.
Update the application FQDN on the source cluster in the DNS server to return the IP address of the exterior network component.
Configure the network component to send requests received for the application in the source domain to the load balancer in the target cluster domain.
Create a wildcard DNS record for the
*.apps.source.example.com
domain that points to the IP address of the load balancer of the source cluster.Create a DNS record for each application that points to the IP address of the exterior network component in front of the target cluster. A specific DNS record has higher priority than a wildcard record, so no conflict arises when the application FQDN is resolved.
|
Setting up the target cluster to accept the source DNS domain
You can set up the target cluster to accept requests for a migrated application in the DNS domain of the source cluster.
Procedure
For both non-secure HTTP access and secure HTTPS access, perform the following steps:
Create a route in the target cluster’s project that is configured to accept requests addressed to the application’s FQDN in the source cluster:
$ oc expose svc <app1-svc> --hostname <app1.apps.source.example.com> \
-n <app1-namespace>
With this new route in place, the server accepts any request for that FQDN and sends it to the corresponding application pods. In addition, when you migrate the application, another route is created in the target cluster domain. Requests reach the migrated application using either of these hostnames.
Create a DNS record with your DNS provider that points the application’s FQDN in the source cluster to the IP address of the default load balancer of the target cluster. This will redirect traffic away from your source cluster to your target cluster.
The FQDN of the application resolves to the load balancer of the target cluster. The default Ingress Controller router accept requests for that FQDN because a route for that hostname is exposed.
For secure HTTPS access, perform the following additional step:
Replace the x509 certificate of the default Ingress Controller created during the installation process with a custom certificate.
Configure this certificate to include the wildcard DNS domains for both the source and target clusters in the
subjectAltName
field.The new certificate is valid for securing connections made using either DNS domain.
Additional resources
- See Replacing the default ingress certificate for more information.
Network traffic redirection strategies
After a successful migration, you must redirect network traffic of your stateless applications from the source cluster to the target cluster.
The strategies for redirecting network traffic are based on the following assumptions:
The application pods are running on both the source and target clusters.
Each application has a route that contains the source cluster hostname.
The route with the source cluster hostname contains a CA certificate.
For HTTPS, the target router CA certificate contains a Subject Alternative Name for the wildcard DNS record of the source cluster.
Consider the following strategies and select the one that meets your objectives.
Redirecting all network traffic for all applications at the same time
Change the wildcard DNS record of the source cluster to point to the target cluster router’s virtual IP address (VIP).
This strategy is suitable for simple applications or small migrations.
Redirecting network traffic for individual applications
Create a DNS record for each application with the source cluster hostname pointing to the target cluster router’s VIP. This DNS record takes precedence over the source cluster wildcard DNS record.
Redirecting network traffic gradually for individual applications
Create a proxy that can direct traffic to both the source cluster router’s VIP and the target cluster router’s VIP, for each application.
Create a DNS record for each application with the source cluster hostname pointing to the proxy.
Configure the proxy entry for the application to route a percentage of the traffic to the target cluster router’s VIP and the rest of the traffic to the source cluster router’s VIP.
Gradually increase the percentage of traffic that you route to the target cluster router’s VIP until all the network traffic is redirected.
User-based redirection of traffic for individual applications
Using this strategy, you can filter TCP/IP headers of user requests to redirect network traffic for predefined groups of users. This allows you to test the redirection process on specific populations of users before redirecting the entire network traffic.
Create a proxy that can direct traffic to both the source cluster router’s VIP and the target cluster router’s VIP, for each application.
Create a DNS record for each application with the source cluster hostname pointing to the proxy.
Configure the proxy entry for the application to route traffic matching a given header pattern, such as
test customers
, to the target cluster router’s VIP and the rest of the traffic to the source cluster router’s VIP.Redirect traffic to the target cluster router’s VIP in stages until all the traffic is on the target cluster router’s VIP.