简体   繁体   English

迁移K8S集群

[英]Migration K8S cluster

we have several clusters.我们有几个集群。 Right now, we want to upgrade a K8S cluster replacing it for new one.现在,我们想升级一个 K8S 集群来替换它。

We handle the deployments with CICD, so, when the new cluster is ready, we will start to move apps to the new cluster running the pipelines.我们使用 CICD 处理部署,因此,当新集群准备就绪时,我们将开始将应用程序移动到运行管道的新集群。 We're facing a problem with DNS.我们正面临 DNS 问题。

All the apps in the kubernetes cluster is resolved by a wildcard DNS. kubernetes 集群中的所有应用程序都由通配符 DNS 解析。 Besides, we need to do the migration in multiple steps, so, we can't change the wildcard to the new cluster, because the old cluster is going to host some apps for a while and need to interact between them此外,我们需要分多步进行迁移,因此,我们不能将通配符更改为新集群,因为旧集群将托管一些应用程序一段时间,需要在它们之间进行交互

Any good solution or alternative to get the migration done smoothly?有什么好的解决方案或替代方案可以顺利完成迁移?

And what would be a best practice about DNS to avoid this situation in the future?为了避免将来出现这种情况,DNS 的最佳实践是什么?

Thank you in advance.先感谢您。

You can put in specific DNS records for each hostname as they need to migrate.您可以在需要迁移时为每个主机名放入特定的 DNS 记录。

Say your wildcard is for *.mycompany.com ...假设您的通配符用于*.mycompany.com ...
app1.mycompany.com is getting migrated app1.mycompany.com正在迁移
app2.mycompany.com is staying put until the next batch app2.mycompany.com将保留到下一批

Add a record for app2.mycompany.com pointing to the old cluster, and switch the wildcard record to point to the new cluster.app2.mycompany.com添加一条指向旧集群的记录,并将通配符记录切换为指向新集群。

Now app1.mycompany.com will resolve to the new cluster, but the more specific record for app2.mycompany.com will trump the wildcard and keep pointing to the old cluster.现在app1.mycompany.com将解析到新集群,但app2.mycompany.com的更具体记录将胜过通配符并继续指向旧集群。

When it's time for app2 's DNS cutover, delete the record and the wildcard will take over.app2的 DNS 切换时间到时,删除记录,通配符将接管。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM