What’s New in OpenKruise v1.2? PersistentPodState, CloneSet Enhancements, and More
OpenKruise v1.2 introduces the PersistentPodState CRD for stateful pod retention, improves CloneSet partition logic and status fields, adds markPodNotReady to lifecycle hooks, and expands PodUnavailableBudget to protect custom workloads, with detailed YAML examples and usage notes.
OpenKruise, a CNCF Sandbox project that extends Kubernetes with advanced deployment, upgrade, and stability features, has released version 1.2. All features are delivered via standard CRDs and can be installed with a single Helm command on any Kubernetes 1.16+ cluster.
1. New PersistentPodState CRD and Controller
Stateful workloads often need to preserve more pod attributes than the built‑in StatefulSet provides, such as fixed IP scheduling or node affinity. The new PersistentPodState CRD lets users define the desired pod state and automatically enforces it after pod recreation.
apiVersion: apps.kruise.io/v1alpha1
kind: PersistentPodState
metadata:
name: echoserver
namespace: echoserver
spec:
targetRef:
apiVersion: apps.kruise.io/v1beta1
kind: StatefulSet
name: echoserver
requiredPersistentTopology:
nodeTopologyKeys:
- failure-domain.beta.kubernetes.io/zone
preferredPersistentTopology:
- preference:
nodeTopologyKeys:
- kubernetes.io/hostname
weight: 100By annotating a StatefulSet with kruise.io/auto-generate-persistent-pod-state: "true", OpenKruise will create the corresponding PersistentPodState object automatically.
2. CloneSet Partition Logic and New Status Fields
Previously CloneSet rounded up the calculated partition when a percentage was used, which could result in no pods being upgraded for small percentages. Starting with v1.2, CloneSet guarantees at least one pod upgrade when the partition is below 100% (except when replicas ≤ 1). To make the upgrade intent clearer, a new status field expectedUpdatedReplicas shows the number of pods that should be upgraded based on the current partition.
apiVersion: apps.kruise.io/v1alpha1
kind: CloneSet
spec:
replicas: 8
updateStrategy:
partition: 90%
status:
replicas: 8
expectedUpdatedReplicas: 1
updatedReplicas: 1
updatedReadyReplicas: 13. Lifecycle Hook Enhancements – markPodNotReady
OpenKruise now supports a markPodNotReady flag in lifecycle hooks. When set to true, the pod is forced into a NotReady state during PreDelete or InPlaceUpdate phases, preventing it from being considered healthy while custom cleanup actions run. The pod is restored to Ready once the hook completes.
type Lifecycle struct {
PreDelete *LifecycleHook `json:"preDelete,omitempty"`
InPlaceUpdate *LifecycleHook `json:"inPlaceUpdate,omitempty"`
}
type LifecycleHook struct {
// ... other fields ...
MarkPodNotReady bool `json:"markPodNotReady,omitempty"`
}4. PodUnavailableBudget Extends to Custom Workloads
PodUnavailableBudget (PUB) now protects any workload that declares the scale subresource, not just built‑in types like Deployment or CloneSet. Adding the following annotation to a CRD generated by kubebuilder or operator‑sdk enables PUB support:
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.labelSelectorAdditionally, PUB disables deep copy during client list operations to improve performance in large clusters.
5. Other Minor Changes
The release also includes various bug fixes, documentation updates, and performance tweaks. Full change logs and contributor details are available on the GitHub release page.
Community members are encouraged to join the discussion via the OpenKruise GitHub repository, Slack channel, DingTalk group, or WeChat group.
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.
