Master Canary Deployments with Kruise Rollout: Gateway API, StatefulSet & Pod Batch Labels
This article explains how the open‑source Kruise Rollout framework enables progressive delivery on Kubernetes, covering Gateway API‑based canary releases, batch rollouts for StatefulSet and Advanced StatefulSet, pod batch labeling, and integration with KubeVela for seamless canary deployments.
Introduction
Kruise Rollout is an open‑source progressive delivery framework from the OpenKruise community. It supports canary, blue‑green, and A/B testing releases, can drive traffic and instance gray‑scale, and can automate batch pauses based on Prometheus metrics. It works with common workloads such as Deployment, CloneSet, StatefulSet and the Advanced StatefulSet extension.
Canary Release with Gateway API
The Ingress API has limitations for complex networking scenarios, so the SIG‑NETWORK community introduced the Gateway API as a unified standard. Kruise Rollout can use a HTTPRoute to perform canary releases. The example below defines a route to an echoserver service and a Rollout that releases 20 % of traffic with a pause.
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: HTTPRoute
metadata:
name: echoserver
spec:
hostnames:
- test.app.domain
rules:
- backendRefs:
- group: ""
name: echoserver
port: 80
---
apiVersion: rollouts.kruise.io/v1alpha1
kind: Rollout
spec:
objectRef:
...
strategy:
canary:
steps:
- weight: 20
pause: {}
trafficRoutings:
- service: echoserver
gateway:
httpRouteName: echoserverBatch Release for StatefulSet and Advanced StatefulSet
Stateful applications can also use progressive delivery. By leveraging the native StatefulSet partition feature, Rollout can manage batch upgrades for both standard StatefulSet and Advanced StatefulSet.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: echoserver
spec:
replicas: 5
template:
spec:
containers:
- name: echoserver
image: cilium/echoserver:latest
---
apiVersion: rollouts.kruise.io/v1alpha1
kind: Rollout
metadata:
name: rollouts-demo
spec:
objectRef:
workloadRef:
apiVersion: apps/v1
kind: StatefulSet
name: echoserver
strategy:
canary:
steps:
- replicas: 1
pause: {}
- replicas: 2
pause: {duration: 60}
- replicas: 2Pod Batch Labeling Feature
Kruise Rollout adds the label apps.kruise.io/rollout-batch-id to Pods, where the value corresponds to the batch number (1, 2, 3 …). The rolloutID field, supplied by the platform or user, distinguishes different releases and prevents label collisions when using in‑place upgrades of CloneSet.
apiVersion: rollouts.kruise.io/v1alpha1
kind: Rollout
metadata:
name: rollouts-demo
spec:
...
# required
rolloutID: v1The rolloutID can be any unique string, for example webserver-20220728120533.
Integration with KubeVela
KubeVela, an OAM‑based cloud‑native application platform, integrates Kruise Rollout as a trait. Users can enable canary releases via a Helm chart by adding a kruise-rollout trait to an Application definition.
apiVersion: core.oam.dev/v1beta1
kind: Application
spec:
components:
- name: canary-demo
type: webservice
properties:
image: barnett/canarydemo:v1
traits:
- type: kruise-rollout
properties:
canary:
steps:
- weight: 20
trafficRoutings:
- type: nginxReferences
https://github.com/openkruise/rollouts
https://kubevela.io/
https://openkruise.io/
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Alibaba Cloud Native
We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
