蓝绿色转换策略
问题描述:
我正在测试在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
答
在更新K8S LoadBalancer类型服务期间,底层的ELB不应该改变。您确定您确实更新了服务(kubectl apply
)而不是重新创建(kubectl delete
/kubectl create
)?