【发布时间】:2017-08-31 21:52:57
【问题描述】:
我正在 AWS 上运行的 k8s (1.7.4) 上测试蓝绿色更新,其中蓝绿色服务可从 k8s 外部访问。当前设置是一个蓝色 pod、一个绿色 pod 和一个服务路由器。路由器设置是 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
【问题讨论】:
标签: amazon-web-services kubernetes