灰度發佈
優先級:canary-by-header -> canary-by-cookie -> canary-weight
基於header:
# 配置
nginx.ingress.kubernetes.io/canary: "true"
nginx.ingress.kubernetes.io/canary-by-header: "canary"
# 訪問方式
curl -H "canary: always" http://xxxxxx #都訪問carry
curl -H "canary: never" http://xxxxxxx #都不訪問carry
curl -H "canary: lalaa" http://xxxxxxx #請求其他 Canary 規則
# 配置
nginx.ingress.kubernetes.io/canary: "true"
nginx.ingress.kubernetes.io/canary-by-header: "canary"
nginx.ingress.kubernetes.io/canary-by-header-value: "hahaha"
# 訪問方式
curl -H "canary: hahaha" http://xxxxxx #都訪問carry
curl -H "canary: lslsls" http://xxxxxx #請求其他 Canary 規則
curl -H "canary: always" http://xxxxxx #請求其他 Canary 規則
curl -H "canary: never" http://xxxxxxx #請求其他 Canary 規則
基於cookie:
# 配置
nginx.ingress.kubernetes.io/canary: "true"
nginx.ingress.kubernetes.io/canary-by-cookie: "users_from_Beijing"
# 訪問方式
curl -b "users_from_Beijing=always" http://xxxxxx #都訪問carry
curl -b "users_from_Beijing=never" http://xxxxxxx #都不訪問carry
curl -b "users_from_Beijing=lalala" http://xxxxxx #請求其他 Canary 規則
基於weight:
nginx.ingress.kubernetes.io/canary: "true"
nginx.ingress.kubernetes.io/canary-weight: "30"