蓝绿色改变策略

时间:2017-08-31 13:44:16

标签: amazon-web-services kubernetes

我正在测试在AWS上运行的k8s(1.7.4)上的蓝绿色更新,其中蓝绿色服务可从外部k8s到达。当前设置是蓝色窗格,绿色窗格和服务路由器。路由器设置是AWS ELB。该服务可通过指向ELB的CNAME访问。

问题出在切换期间。更新服务会产生新的ELB,从而产生CNAME的新目标。等待DNS传播的时间是停机时间。另一种避免停机的方法是什么?服务yml如下:

##########
# ROUTER #
##########

# This blue green approach does not work because the AWS ELB must be created
# new on each changeoever. This results in a new DNS record and clients are
# lost while the new record propagates.

# Expose the container as a service to the outside via DNS record and port.
apiVersion: v1
kind: Service
metadata:
  name: helloworld
  annotations:
    # URL for the service
    external-dns.alpha.kubernetes.io/hostname: helloworld.k8s.example.net
spec:
  type: LoadBalancer
  ports:
    # Outside port mapped to deployed container port
  - port: 80
    targetPort: helloworldport
  selector:
    #  HOWTO change app name to point to blue or green then
    #  ubectl replace -f bluegreenrouter.yml --force
    app: helloworld-blue

1 个答案:

答案 0 :(得分:1)

在更新K8S LoadBalancer类型服务期间,底层ELB永远不会更改。您确定实际更新了服务(kubectl apply)而未重新创建(kubectl delete / kubectl create)吗?