1.金丝雀发布流程,安装比例发布,又名灰度发布
举例:共10pod
- 第一批发布 30%
- V1 : 10个Pod
- V2: 3个Pod
- 第二批发布 60%
- V1 : 10个Pod
- V2: 6个Pod
- 第三批发布 100%
- V1 : 10个Pod
- V2: 10个Pod
- 第四批发布
- V2: 10个Pod (active)
- V1: 0个Pod
2.资源文件准备
文件放到:https://gitee.com/arionyu/k8syaml.git
目录:argo/argo-rollout/金丝雀部署/ingresstest
ingress创建
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: demo-stable-ingress namespace: argo-rollouts annotations: kubernetes.io/ingress.class: nginx acme.cert-manager.io/http01-edit-in-place: "true" #没有这个会导致All hosts are taken by other resources
spec: ingressClassName: nginx rules: - host: yuqiao.test.com http: paths: - backend: service: name: stable-service port: number: 80 path: / pathType: Prefix
service创建
apiVersion: v1 kind: Service metadata: name: rollout-bluegreen-active namespace: argo-rollouts spec: ports: - nodePort: 30131 port: 80 protocol: TCP targetPort: 80 selector: app: rollout-bluegreen sessionAffinity: None type: NodePort --- apiVersion: v1 kind: Service metadata: name: rollout-bluegreen-preview namespace: argo-rollouts spec: ports: - nodePort: 30132 port: 80 protocol: TCP targetPort: 80 selector: app: rollout-bluegreen sessionAffinity: None type: NodePort
rollout部署
apiVersion: argoproj.io/v1alpha1 kind: Rollout metadata: name: simple-rollout spec: replicas: 4 strategy: canary: canaryService: canary-service # required stableService: stable-service # required trafficRouting: nginx: # Either stableIngress or stableIngresses must be configured, but not both. stableIngress: demo-stable-ingress steps: - setWeight: 30 - pause: {} - setWeight: 60 - pause: {} - setWeight: 100 - pause: {} revisionHistoryLimit: 2 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx # image: nginx:1.21.1 image: registry.cn-hangzhou.aliyuncs.com/yushihao/nginx:latest ports: - name: http containerPort: 80 protocol: TCP imagePullSecrets: - name: aliharbor
标签:ingress,name,--,金丝雀,nginx,argo,rollout,Pod From: https://www.cnblogs.com/aroin/p/17967988