For demo purpose, this tutorial introduces how to setup KusionStack Rollout on local Kubernetes by kind.
Please install the following tools:
Build the environment locally by running the script
bash hack/local-demo.sh
The script performs the following tasks:
- Create a local kubernetes cluster named
kusionstack-rollout
bykind
- Install all rollout CustomResourceDefinations
- Compile rollout controller, build image and load it into kind cluster
- Run rollout controller on local kubernetes cluster
- Create a rollout CR named
rollout-demo
and two statefulsets namedrollout-demo1
androllout-demo2
After script finished:
- you can check statefulsets in default namespace by
kubectl --context kind-kusionstack-rollout -n default get statefulsets
- you can check rollout in default namespace by
kubectl --context kind-kusionstack-rollout -n default get rollouts -oyaml
The status should be
status:
conditions:
- lastTransitionTime: "2024-01-09T12:08:02Z"
lastUpdateTime: "2024-01-09T12:08:02Z"
message: rollout is not triggered
reason: UnTriggered
status: "False"
type: Progressing
lastUpdateTime: "2024-01-09T12:08:02Z"
observedGeneration: 1
phase: Initialized
Then update all statefulsets by:
kubectl --context kind-kusionstack-rollout apply -f hack/testdata/local-up/update-workloads.yaml
Check the rollout status
kubectl --context kind-kusionstack-rollout -n default get rollouts -oyaml
If you see the following status, that means the rollout is paused now.
status:
batchStatus:
currentBatchIndex: 1
currentBatchState: Paused
Run following command to let rollout continue:
kubectl --context kind-kusionstack-rollout annotate rollout rollout-demo --overwrite rollout.kusionstack.io/manual-command="resume"
Check status again, finally you can see:
status:
batchStatus:
currentBatchIndex: 2
currentBatchState: Succeeded
conditions:
- message: rolloutRun is completed
reason: Completed
status: "False"
type: Progressing
Finally, you can clean up the whole test enviroment:
kind delete cluster --name kusionstack-rollout