<p>I would like to migrate an application from one GKE cluster to another, and I'm wondering how to accomplish this while avoiding any downtime for this process.</p>
<p>The application is an HTTP web backend.</p>
<p>Usually how I'd usually handle this in a non GCP/K8S context is have a load balancer in front of the application, setup a new web backend and then just update the appropriate IP address in the load balancer to point from the old IP to the new IP. This would essentially have 0 downtime while also allowing for a seemless rollback if anything goes wrong.</p>
<p>I do not see why this should not work for this context as well however I'm not 100% sure. And if there is a more robust or alternative way to do this (GCP/GKE friendly way), I'd like to investigate that.</p>
<p><strong>So to summarize my question,</strong> does GCP/GKE support this type of migration functionality? If not, is there any implications I need to be aware of with my usual load balancer approach mentioned above?</p>
<hr />
<p>The reason for migrating is the current k8s cluster is running quite an old version (1.18)  and if doing an GKE version upgrade to something more recent like 1.22, I suspect a lot of incompatibilities as well risk.</p>

Chris Stryczynski
<p><strong>Few pain points you'll run into:</strong></p>
<ol>
<li>As someone used to DIY Kubernetes I hate GKE's managed Ingress Certs, because they make it very hard to pre-provision HTTPS certs in advance on the new cluster. (GKE's defacto method of provisioning HTTPS certs is to update DNS to point to the LB, and then wait 10-60 minutes. That means if you cutover to a new cluster the new cluster's HTTPS cert supplied by a managedcertificate Custom Resource, won't be ready in advance.)</li>
<li>It is possible to use pre-provision HTTPS certs using ACME-DNS challenge on GCP, but it's poorly documented and a god awful UX(user experience), there's no GUI, and the CLI API is terrible.
You can do it using <code>gcloud services enable certificatemanager.googleapis.com</code>, but I'd highly recommend against
that certificate-manager service that went GA in June, 2022. The UX is painful.</li>
<li>GKE's official docs are pretty bad when it comes to this scenario</li>
</ol>
<p><strong>You basically want to do 2 things:</strong></p>
<ol>
<li>Follow this how to guide for a zero downtime HTTPS cutover from cluster1 to cluster2 by leveraging Lets Encrypt Free Cert<br />
<a href="https://gist.github.com/neoakris/4aafeac7628995da8dd423f1702c975b" rel="nofollow noreferrer">https://gist.github.com/neoakris/4aafeac7628995da8dd423f1702c975b</a><br />
(I know link only answers are bad, but it's github (great uptime) and it's way too long and nuanced to post here.)</li>
<li>Use Velero to migrate workloads from cluster1 to cluster2 (it migrate can do CRDs, CRs, generic yaml objects, and PV/PVCs. One thing of note is Velero works best when you're migrate to and from a cluster of the same version, if you go from a really old version to a really new version you could encounter issues where kubernetes yaml APIs got removed in the new version. Going from old version to new version can be done, but it's best left to an experienced hand. For Happy Path results migrating to and from a cluster of the same version is best.)</li>
</ol>
