kubevela - canary rollout with openkruise
Install openkruise add on using the following commnad
vela addon enable kruise-rollout
Next, deploy this.
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: canary-demo
annotations:
app.oam.dev/publishVersion: v1
spec:
components:
- name: canary-demo
type: webservice
properties:
image: wangyikewyk/canarydemo:v1
ports:
- port: 8090
traits:
- type: scaler
properties:
replicas: 5
- type: gateway
properties:
domain: canary-demo.com
http:
"/version": 8090
You can see 5 replicas running. Then rollout canary deployment
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: canary-demo
annotations:
app.oam.dev/publishVersion: v2
spec:
components:
- name: canary-demo
type: webservice
properties:
image: wangyikewyk/canarydemo:v2
ports:
- port: 8090
traits:
- type: scaler
properties:
replicas: 5
- type: gateway
properties:
domain: canary-demo.com
http:
"/version": 8090
workflow:
steps:
- type: canary-deploy
name: rollout-20
properties:
weight: 20
- name: suspend-1st
type: suspend
- type: canary-deploy
name: rollout-50
properties:
weight: 50
- name: suspend-2nd
type: suspend
- type: canary-deploy
name: rollout-100
properties:
weight: 100
After you run the following, you need to approve from the cli using
vela workflow resume canary-demo
After resuming you will see the pods are being replaced.
The green shows the new rollout - where it replaces 50% of our existing pods with new version of the applications.
Red shows the old pods.
Comments