用于蓝绿色或 A/B 部署的无头服务

Headless service for blue green or A/B deployment

在蓝绿或 A/B 部署的情况下,我们如何使无头服务工作?

当我们进行切换时,服务 ID 会移动,但我们如何让应用程序知道它?

遗憾的是,无法使用 headless service 创建 blue/green 部署。这是因为:

Sometimes you don't need load-balancing and a single Service IP. In this case, you can create what are termed "headless" Services, by explicitly specifying "None" for the cluster IP (.spec.clusterIP).

但是,如果要创建 blue/green 部署,则需要网络流量控制工具在 pods 之间切换。您还可以阅读更多 here:

If working with headless services, traffic splits cannot be retrieved. Linkerd reads service discovery information based off the target IP address, and if that happens to be a pod IP address then it cannot tell which service the pod belongs to.