2

I need to change the IP address of a production web server. I was wondering if that is possible to do without downtime. The steps I thought would work were:

  1. Reserve a new static IP address
  2. Add the IP address to the DNS for the domain I'm switching
  3. Deploy the kubernetes config that uses the new static IP
  4. Remove the old DNS entry
  5. Unreserve the old static IP address

Should I expect this to work? If nothing is listening on the other side of the new IP address, do most things just change over to the other IP address? Or do they fail hard?

  • 4
    Any existing TCP connections will break. – Ron Maupin Jul 22 '19 at 23:24
  • 5
    Don't forget to allow for DNS propagation time. Shorten $TTL before you start, and expect that for some period of time after the DNS changes, clients will get an unpredictable mix of the old and new DNS information, depending on what they have cached previously. – Jim L. Jul 22 '19 at 23:42
  • Make sure to leave the system running with the old IP address (also) until you can see there is no more traffic to it. Either keep it as separate, or alias it to the new server, or do some NAT. The proper way depends on many other parameters like the kind of application on it (long running streams or bursts), and also your DNS config. – Patrick Mevzek Jul 24 '19 at 5:57
1

The key phrase in your question is "without downtime" and the answer for your apparent configuration is "no." Let's assume your production web server is production.example.com.

Here's the timeline in your original post:

  1. Add the IP address to the DNS for the domain I'm switching

What is the FQDN that you're adding at this point? If it isn't the production.example.com address, then this new A record isn't doing anything to facilitate routing traffic to your new IP. If it is the A record for production.example.com then your TTL will come into play. I typically set mine to 300 (5 minutes) but that doesn't mean you have 5 minutes to execute step 3. Once that new address begins propagating to your clients they will begin trying to land HTTP requests on the new IP.

  1. Deploy the kubernetes config that uses the new static IP

Once you do this and restart your webserver any current TCP sessions will break which implies any inflight HTTP(s) requests will fail.

As to your question "If nothing is listening on the other side of the new IP address, do most things just change over to the other IP address?", yes, if there is no HTTP activity then you're okay.

In my experience, the "no downtime" requirement is hard to meet, and by hard I mean complex and expensive. What one should strive for is minimal downtime which can be achieved by having a solid process by which you're going to migrate the website, whether it be changing an IP address or moving it to a different server or upgrading an underlying database. Once you've developed the process, test it to see how your traffic behaves and where your assumptions are confirmed or denied. Refine the process to achieve the downtime metrics you're after, and test it again. Wash, rinse, and repeat.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.