Files
kubevela/docs/examples/workflow-with-ocm/rollout

Rollout with OCM

In this tutorial, you will use rollout in runtime cluster with OCM.

Prerequisites

  • Have a multi-cluster environment witch have installed OCM by following this guide. The name of managed cluster generally is poc-01.

  • Install vela-rollout chart in managed-cluster with Helm.

$ helm repo add kubevela https://charts.kubevela.net/core
$ helm install vela-rollout  --create-namespace -n vela-system kubevela/vela-rollout

Install workflowStepDefinition

Apply workflowStepDefinitions in control-plane cluster.

$ kubectl apply -f dispatchRevDef.yaml
$ kubectl apply -f dispatchTraits.yaml

Deploy and rollout

  1. Apply application in control-plane cluster.
$ kubectl apply -f app-first-scale.yaml

Wait a few minutes, check rollout and workload status in managed cluster.

$ kubectl get rollout
NAME           TARGET   UPGRADED   READY   BATCH-STATE   ROLLING-STATE    AGE
nginx-server   2        2          2       batchReady    rolloutSucceed   25h
$ kubectl get deploy
NAME              READY   UP-TO-DATE   AVAILABLE   AGE
nginx-server-v1   2/2     2            2           25h
  1. Update application to v2.
$ kubectl apply -f app-update-v2.yaml

check rollout and workload status.

$ kubectl get rollout
NAME           TARGET   UPGRADED   READY   BATCH-STATE   ROLLING-STATE    AGE
nginx-server   2        2          2       batchReady    rolloutSucceed   25h
$ kubectl get deploy
NAME              READY   UP-TO-DATE   AVAILABLE   AGE
nginx-server-v2   2/2     2            2           25h
  1. Scale up.
$ kubectl apply -f app-v2-scale.yaml

check the status of rollout and workload.

$ kubectl get rollout
NAME           TARGET   UPGRADED   READY   BATCH-STATE   ROLLING-STATE    AGE
nginx-server   4        4          4       batchReady    rolloutSucceed   25h
$ kubectl get deploy
NAME              READY   UP-TO-DATE   AVAILABLE   AGE
nginx-server-v2   4/4     4            4           25h
  1. Roll back to v1.
$ kubectl apply -f app-revert.yaml

check rollout and workload status.

$ kubectl get rollout
NAME           TARGET   UPGRADED   READY   BATCH-STATE   ROLLING-STATE    AGE
nginx-server   4        4          4       batchReady    rolloutSucceed   25h
$ kubectl get deploy
NAME              READY   UP-TO-DATE   AVAILABLE   AGE
nginx-server-v1   4/4     4            4           25h
  1. Scale down.
$ kubectl apply -f app-scale-down-v1.yaml

check rollout and workload status.

$ kubectl get rollout
NAME           TARGET   UPGRADED   READY   BATCH-STATE   ROLLING-STATE    AGE
nginx-server   2        2          2       batchReady    rolloutSucceed   25h
$ kubectl get deploy
NAME              READY   UP-TO-DATE   AVAILABLE   AGE
nginx-server-v1   2/2     2            2           25h