• Argo rollouts + istio服务网格实现金丝雀灰度发布


    1. 安装部署lstio
      https://istio.io/latest/zh/docs/setup/getting-started/
    curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.6.8 TARGET_ARCH=x86_64 sh -
    cd istio-1.14.3
    cp istio-1.14.3/bin/istioctl  /usr/bin
    istioctl install --set profile=demo -y
    kubectl label namespace default istio-injection=enabled
    
    • 1
    • 2
    • 3
    • 4
    • 5
    1. 自建LoadBalancer当然也可以使用nodeport方式
    #kubectl create  ns metallb-system
    #cat metallb-configMap.yaml
    apiVersion: v1
    kind: ConfigMap
    metadata:
      namespace: metallb-system
      name: config
    data:
      config: |
        address-pools:
        - name: default
          protocol: layer2
          addresses:
          - 192.168.10.103-192.168.10.105   #地址池
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    #cat metallb.yaml
    apiVersion: policy/v1beta1
    kind: PodSecurityPolicy
    metadata:
      labels:
        app: metallb
      name: controller
      namespace: metallb-system
    spec:
      allowPrivilegeEscalation: false
      allowedCapabilities: []
      allowedHostPaths: []
      defaultAddCapabilities: []
      defaultAllowPrivilegeEscalation: false
      fsGroup:
        ranges:
        - max: 65535
          min: 1
        rule: MustRunAs
      hostIPC: false
      hostNetwork: false
      hostPID: false
      privileged: false
      readOnlyRootFilesystem: true
      requiredDropCapabilities:
      - ALL
      runAsUser:
        ranges:
        - max: 65535
          min: 1
        rule: MustRunAs
      seLinux:
        rule: RunAsAny
      supplementalGroups:
        ranges:
        - max: 65535
          min: 1
        rule: MustRunAs
      volumes:
      - configMap
      - secret
      - emptyDir
    ---
    apiVersion: policy/v1beta1
    kind: PodSecurityPolicy
    metadata:
      labels:
        app: metallb
      name: speaker
      namespace: metallb-system
    spec:
      allowPrivilegeEscalation: false
      allowedCapabilities:
      - NET_ADMIN
      - NET_RAW
      - SYS_ADMIN
      allowedHostPaths: []
      defaultAddCapabilities: []
      defaultAllowPrivilegeEscalation: false
      fsGroup:
        rule: RunAsAny
      hostIPC: false
      hostNetwork: true
      hostPID: false
      hostPorts:
      - max: 7472
        min: 7472
      privileged: true
      readOnlyRootFilesystem: true
      requiredDropCapabilities:
      - ALL
      runAsUser:
        rule: RunAsAny
      seLinux:
        rule: RunAsAny
      supplementalGroups:
        rule: RunAsAny
      volumes:
      - configMap
      - secret
      - emptyDir
    ---
    apiVersion: v1
    kind: ServiceAccount
    metadata:
      labels:
        app: metallb
      name: controller
      namespace: metallb-system
    ---
    apiVersion: v1
    kind: ServiceAccount
    metadata:
      labels:
        app: metallb
      name: speaker
      namespace: metallb-system
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRole
    metadata:
      labels:
        app: metallb
      name: metallb-system:controller
    rules:
    - apiGroups:
      - ''
      resources:
      - services
      verbs:
      - get
      - list
      - watch
      - update
    - apiGroups:
      - ''
      resources:
      - services/status
      verbs:
      - update
    - apiGroups:
      - ''
      resources:
      - events
      verbs:
      - create
      - patch
    - apiGroups:
      - policy
      resourceNames:
      - controller
      resources:
      - podsecuritypolicies
      verbs:
      - use
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRole
    metadata:
      labels:
        app: metallb
      name: metallb-system:speaker
    rules:
    - apiGroups:
      - ''
      resources:
      - services
      - endpoints
      - nodes
      verbs:
      - get
      - list
      - watch
    - apiGroups:
      - ''
      resources:
      - events
      verbs:
      - create
      - patch
    - apiGroups:
      - policy
      resourceNames:
      - speaker
      resources:
      - podsecuritypolicies
      verbs:
      - use
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: Role
    metadata:
      labels:
        app: metallb
      name: config-watcher
      namespace: metallb-system
    rules:
    - apiGroups:
      - ''
      resources:
      - configmaps
      verbs:
      - get
      - list
      - watch
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: Role
    metadata:
      labels:
        app: metallb
      name: pod-lister
      namespace: metallb-system
    rules:
    - apiGroups:
      - ''
      resources:
      - pods
      verbs:
      - list
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
      labels:
        app: metallb
      name: metallb-system:controller
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: metallb-system:controller
    subjects:
    - kind: ServiceAccount
      name: controller
      namespace: metallb-system
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
      labels:
        app: metallb
      name: metallb-system:speaker
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: metallb-system:speaker
    subjects:
    - kind: ServiceAccount
      name: speaker
      namespace: metallb-system
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: RoleBinding
    metadata:
      labels:
        app: metallb
      name: config-watcher
      namespace: metallb-system
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: Role
      name: config-watcher
    subjects:
    - kind: ServiceAccount
      name: controller
    - kind: ServiceAccount
      name: speaker
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: RoleBinding
    metadata:
      labels:
        app: metallb
      name: pod-lister
      namespace: metallb-system
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: Role
      name: pod-lister
    subjects:
    - kind: ServiceAccount
      name: speaker
    ---
    apiVersion: apps/v1
    kind: DaemonSet
    metadata:
      labels:
        app: metallb
        component: speaker
      name: speaker
      namespace: metallb-system
    spec:
      selector:
        matchLabels:
          app: metallb
          component: speaker
      template:
        metadata:
          annotations:
            prometheus.io/port: '7472'
            prometheus.io/scrape: 'true'
          labels:
            app: metallb
            component: speaker
        spec:
          containers:
          - args:
            - --port=7472
            - --config=config
            env:
            - name: METALLB_NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: METALLB_HOST
              valueFrom:
                fieldRef:
                  fieldPath: status.hostIP
            - name: METALLB_ML_BIND_ADDR
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: METALLB_ML_LABELS
              value: "app=metallb,component=speaker"
            - name: METALLB_ML_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: METALLB_ML_SECRET_KEY
              valueFrom:
                secretKeyRef:
                  name: memberlist
                  key: secretkey
            image: metallb/speaker:v0.9.3
            imagePullPolicy: Always
            name: speaker
            ports:
            - containerPort: 7472
              name: monitoring
            resources:
              limits:
                cpu: 100m
                memory: 100Mi
            securityContext:
              allowPrivilegeEscalation: false
              capabilities:
                add:
                - NET_ADMIN
                - NET_RAW
                - SYS_ADMIN
                drop:
                - ALL
              readOnlyRootFilesystem: true
          hostNetwork: true
          nodeSelector:
            beta.kubernetes.io/os: linux
          serviceAccountName: speaker
          terminationGracePeriodSeconds: 2
          tolerations:
          - effect: NoSchedule
            key: node-role.kubernetes.io/master
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      labels:
        app: metallb
        component: controller
      name: controller
      namespace: metallb-system
    spec:
      revisionHistoryLimit: 3
      selector:
        matchLabels:
          app: metallb
          component: controller
      template:
        metadata:
          annotations:
            prometheus.io/port: '7472'
            prometheus.io/scrape: 'true'
          labels:
            app: metallb
            component: controller
        spec:
          containers:
          - args:
            - --port=7472
            - --config=config
            image: metallb/controller:v0.9.3
            imagePullPolicy: Always
            name: controller
            ports:
            - containerPort: 7472
              name: monitoring
            resources:
              limits:
                cpu: 100m
                memory: 100Mi
            securityContext:
              allowPrivilegeEscalation: false
              capabilities:
                drop:
                - all
              readOnlyRootFilesystem: true
          nodeSelector:
            beta.kubernetes.io/os: linux
          securityContext:
            runAsNonRoot: true
            runAsUser: 65534
          serviceAccountName: controller
          terminationGracePeriodSeconds: 0
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326
    • 327
    • 328
    • 329
    • 330
    • 331
    • 332
    • 333
    • 334
    • 335
    • 336
    • 337
    • 338
    • 339
    • 340
    • 341
    • 342
    • 343
    • 344
    • 345
    • 346
    • 347
    • 348
    • 349
    • 350
    • 351
    • 352
    • 353
    • 354
    • 355
    • 356
    • 357
    • 358
    • 359
    • 360
    • 361
    • 362
    • 363
    • 364
    • 365
    • 366
    • 367
    • 368
    • 369
    • 370
    • 371
    • 372
    • 373
    • 374
    • 375
    • 376
    • 377
    • 378
    • 379
    • 380
    • 381
    • 382
    • 383
    • 384
    • 385
    • 386
    • 387
    • 388
    • 389
    • 390
    • 391
    • 392
    • 393
    1. 引用配置
    kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"
    kubectl apply -f metallb.yaml
    kubectl apply -f metallb-configMap.yaml
    
    • 1
    • 2
    • 3

    查看istio的lb地址用于后面访问:
    在这里插入图片描述

    1. 直接使用nodeport也行(2,4选一个)
    kubectl  edit     svc   istio-ingressgateway   -n istio-system
    
    • 1

    在这里插入图片描述

    1. 部署argo rollouts
      官网:https://argo-rollouts.readthedocs.io/en/v1.2.0/installation/
    kubectl create namespace argo-rollouts
    kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/install.yaml
    
    • 1
    • 2
    1. 安装插件
    curl -LO https://github.com/argoproj/argo-rollouts/releases/latest/download/kubectl-argo-rollouts-linux-amd64
    chmod +x ./kubectl-argo-rollouts-darwin-amd64
    sudo mv ./kubectl-argo-rollouts-darwin-amd64 /usr/local/bin/kubectl-argo-rollouts
    kubectl argo rollouts version
    
    • 1
    • 2
    • 3
    • 4

    在这里插入图片描述
    基本使用可以先看看:https://argo-rollouts.readthedocs.io/en/v1.2.0/getting-started/

    1. istio 业务部署:
    #cat gateway.yaml
    apiVersion: networking.istio.io/v1alpha3
    kind: Gateway
    metadata:
      name: rollouts-demo-gateway
    spec:
      selector:
        istio: ingressgateway # use istio default controller
      servers:
      - port:
          number: 80
          name: http
          protocol: HTTP
        hosts:
        - "*"
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    #cat multipleVirtualsvc.yaml
    apiVersion: networking.istio.io/v1alpha3
    kind: VirtualService
    metadata:
      name: rollouts-demo-vsvc1
    spec:
      gateways:
      - rollouts-demo-gateway
      hosts:
      - "*"
      http:
      - match:
        - uri:
           exact: /23
        route:
        - destination:
            host: rollouts-demo-stable
            port:
              number: 8080
          weight: 0
        - destination:
            host: rollouts-demo-canary
            port:
              number: 8080
          weight: 100
    
    ---
    apiVersion: networking.istio.io/v1alpha3
    kind: VirtualService
    metadata:
      name: rollouts-demo-vsvc2
    spec:
      gateways:
      - rollouts-demo-gateway
      hosts:
      - "*"
      http:
      - match:
        - uri:
            exact: /
        route:
        - destination:
            host: rollouts-demo-stable
            port:
              number: 8080
          weight: 0
        - destination:
            host: rollouts-demo-canary
            port:
              number: 8080
          weight: 100
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    #cat rollout.yaml
    apiVersion: argoproj.io/v1alpha1
    kind: Rollout
    metadata:
      name: rollouts-demo
    spec:
      replicas: 1
      strategy:
        canary:
          canaryService: rollouts-demo-canary
          stableService: rollouts-demo-stable
          trafficRouting:
            istio:
              virtualServices:
              - name: rollouts-demo-vsvc1 # At least one virtualService is required
                #routes: #路由指向
                #- primary # At least one route is required
              - name: rollouts-demo-vsvc2
              #  routes:
              #  - secondary # At least one route is required
          steps:
          - setWeight: 100           #流量控制
          - pause: {}          #手动更新
      revisionHistoryLimit: 2
      selector:
        matchLabels:
          app: rollouts-demo
      template:
        metadata:
          labels:
            app: rollouts-demo
            istio-injection: enabled
        spec:
          containers:
          - name: rollouts-demo
            image: argoproj/rollouts-demo:blue
            ports:
            - name: http
              containerPort: 8080
              protocol: TCP
            resources:
              requests:
                memory: 32Mi
                cpu: 5m
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    #cat services.yaml
    apiVersion: v1
    kind: Service
    metadata:
      name: rollouts-demo-canary
    spec:
      ports:
      - port: 8080
        targetPort: http
        protocol: TCP
        name: http
      selector:
        app: rollouts-demo
        # This selector will be updated with the pod-template-hash of the canary ReplicaSet. e.g.:
        # rollouts-pod-template-hash: 7bf84f9696
    
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: rollouts-demo-stable
    spec:
      ports:
      - port: 8080
        targetPort: http
        protocol: TCP
        name: http
      selector:
        app: rollouts-demo
        # This selector will be updated with the pod-template-hash of the stable ReplicaSet. e.g.:
        # rollouts-pod-template-hash: 789746c88d
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    1. 引用配置
    kubectl apply -f rollout.yaml
    kubectl apply -f services.yaml
    kubectl apply -f multipleVirtualsvc.yaml
    kubectl apply -f gateway.yaml
    
    • 1
    • 2
    • 3
    • 4

    在这里插入图片描述

    1. 查看:
    kubectl argo rollouts get rollout rollouts-demo --watch
    
    • 1

    在这里插入图片描述

    9.访问 istio-ingressgateway 的ip,如果是nodeport方式就需要加80映射的端口

    kubectl get svc -A |grep  istio-ingressgateway
    
    • 1

    在这里插入图片描述
    在这里插入图片描述

    在这里插入图片描述

    1. 查看调度情况rollouts-demo-vsvc1 和rollouts-demo-vsvc2因该都一样的权重
    kubectl describe  vs  rollouts-demo-vsvc1
    
    • 1

    在这里插入图片描述

    1. 修改镜像实现金丝雀:
      kubectl argo rollouts set image rollouts-demo rollouts-demo=tomcat:latest
    
    • 1

    在这里插入图片描述

    1. 再次访问地址2个页面都变成tomcat的页面
      在这里插入图片描述
      在这里插入图片描述

    2. 再次查看权重,流量全都走到了canary上去了,我们改成50权重看看,是不是就是负载均衡这种了。

     kubectl describe  vs  rollouts-demo-vsvc1
    
    • 1

    在这里插入图片描述

    1. 修改权重(2个地方都可以修应该权重,rollout.yaml 和multipleVirtualsvc.yaml)
      在这里插入图片描述
    kubectl apply -f multipleVirtualsvc.yaml
    
    • 1

    查看时候生效:
    在这里插入图片描述
    访问页面是否是负载均衡:
    在这里插入图片描述
    在这里插入图片描述

    第二种方式采用DestinationRule:

    #cat gateway.yaml
    apiVersion: networking.istio.io/v1alpha3
    kind: Gateway
    metadata:
      name: rollouts-demo-gateway
    spec:
      selector:
        istio: ingressgateway # use istio default controller
      servers:
      - port:
          number: 80
          name: http
          protocol: HTTP
        hosts:
        - "*"
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    #cat dr.yaml
    apiVersion: networking.istio.io/v1alpha3
    kind: DestinationRule
    metadata:
      name: rollout-destrule
    spec:
      host: rollout-example.default.svc.cluster.local
    #  port:
    #    number: 8080
      subsets:
      - name: canary   # referenced in canary.trafficRouting.istio.destinationRule.canarySubsetName
        labels:        # labels will be injected with canary rollouts-pod-template-hash value
          app: rollouts-demo
      - name: stable   # referenced in canary.trafficRouting.istio.destinationRule.stableSubsetName
        labels:        # labels will be injected with stable rollouts-pod-template-hash value
          app: rollouts-demo
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    #cat multipleVirtualsvc2.yaml
    
    apiVersion: networking.istio.io/v1alpha3
    kind: VirtualService
    metadata:
      name: rollouts-demo-vsvc1
    spec:
      gateways:
      - rollouts-demo-gateway
      hosts:
      - "*"
      http:
      - match:
        - uri:
            exact: /
        route:
        - destination:
            host: rollout-example
            subset: canary  # referenced in canary.trafficRouting.istio.destinationRule.stableSubsetName
          weight: 100
    #  - route:
        - destination:
            host: rollout-example
            subset: stable # referenced in canary.trafficRouting.istio.destinationRule.canarySubsetName
          weight: 0
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    #cat rolloutzhe.yaml
    apiVersion: argoproj.io/v1alpha1
    kind: Rollout
    metadata:
      name: rollouts-demo
    spec:
      replicas: 1
      strategy:
        canary:
          trafficRouting:
            istio:
              virtualService:
                name: rollouts-demo-vsvc1        # required
                #routes:
                #- primary                 # optional if there is a single route in VirtualService, required otherwise
              destinationRule:
                name: rollout-destrule    # required
                canarySubsetName: canary  # required
                stableSubsetName: stable  # required
          steps:
          - setWeight: 1
          - pause: {}
    
      revisionHistoryLimit: 2
      selector:
        matchLabels:
          app: rollouts-demo
      template:
        metadata:
          labels:
            app: rollouts-demo
            istio-injection: enabled
        spec:
          containers:
          - name: rollouts-demo
            image: argoproj/rollouts-demo:blue
            ports:
            - name: http
              containerPort: 8080
              protocol: TCP
            resources:
              requests:
                memory: 32Mi
                cpu: 5m
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    #cat serverz.yaml
    
    apiVersion: v1
    kind: Service
    metadata:
      name: rollout-example
    spec:
      ports:
      - port: 8080
        targetPort: http
        protocol: TCP
        name: http
      selector:
        app: rollouts-demo
        # This selector will be updated with the pod-template-hash of the canary ReplicaSet. e.g.:
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    1. 引用配置文件
    kubectl apply -f ./
    
    • 1
    1. 访问lb地址;
      在这里插入图片描述

    Istio 503问题:

    istioctl pc route istio-ingressgateway-5665fd9ffc-26wkh.istio-system -oyaml
    
    • 1
  • 相关阅读:
    深度学习笔记之微积分及绘图
    新形势下农商行数据安全体系建设的思考
    DPDK18.08上对VIRTIO IN ORDER 功能所做的优化
    2022PMP项目管理认证考试报考指南(1)
    相对论的应用:GPS导航
    华为OD机考题(HJ71 字符串通配符)
    python中第三方库pyecharts的使用
    谈思生物直播—GENOVIS张洪妍抗体特异性酶切技术助力抗体药物结构表征
    程序员,你被打标签了没?
    creating server tcp listening socket 127.0.0.1:6379: bind No error
  • 原文地址:https://blog.csdn.net/weixin_43606975/article/details/126582211