OpenKruise V0.5.0: Lossless Streaming and Batch Release Policies Now Supported

Background

  • Deployment currently supports maxUnavailable and maxSurge.
  • StatefulSet currently supports the partition policy.
  • Other workloads such as DaemonSet only support maxUnavailable.
  • Deployment does not support phased release. Therefore, it does not support a phased update of 20% of the pods. Until the release is completed, you can only set a smaller maxUnavailable or pause the release upon errors.
  • StatefulSet supports phased release (partition). However, currently, you can only upgrade pods one by one. If there are hundreds or thousands of replicas, the release takes a very long time.

What’s New in V0.5.0

CloneSet Supports maxSurge

  • In-place upgrade, wherein the pod objects, IP addresses, and volumes remain unchanged and only container images are upgraded after a release.
  • Replicas reduction to delete specified pods.
  • Various release policies (such as streaming, phased release, priority, and distribution policies).
apiVersion: apps.kruise.io/v1alpha1
kind: CloneSet
# ...
spec:
replicas: 5 # The total number of pods is 5.
updateStrategy:
maxSurge: 20% # One more pod is expanded: 5 x 20% = 1 (rounded up).
maxUnavailable: 0 # At least five pods are available during the release: 5 - 0 = 5.
partition: 3 # Three old pods are reserved (two pods are released: 5 - 3 = 2).
$ kubectl get clone demo
NAME DESIRED UPDATED UPDATED_READY READY TOTAL AGE
demo 5 1 0 5 6 17m
$ kubectl get clone demo
NAME DESIRED UPDATED UPDATED_READY READY TOTAL AGE
demo 5 2 2 5 5 17m
$ kubectl get clone demo
NAME DESIRED UPDATED UPDATED_READY READY TOTAL AGE
demo 5 3 2 5 6 17m
$ kubectl get clone demo
NAME DESIRED UPDATED UPDATED_READY READY TOTAL AGE
demo 5 5 5 5 5 17m
apiVersion: apps.kruise.io/v1alpha1
kind: CloneSet
# ...
spec:
updateStrategy:
type: InPlaceIfPossible
maxSurge: 20%

SidecarSet Supports Volume Injection and Merging

apiVersion: apps.kruise.io/v1alpha1
kind: SidecarSet
metadata:
name: log-sidecar
spec:
selector:
matchLabels:
app-type: long-term # Inject the container to all pods with the long-term label.
containers:
- name: log-collector
image: xxx:latest
volumeMounts:
- name: log-volume
mountPath: /var/log # Mount log-volume to the /var/log path and collect logs from the path.
volumes:
- name: log-volume # Define a volume named log-volume.
emptyDir: {}
apiVersion: v1
kind: Pod
metadata:
labels:
app-type: long-term
spec:
containers:
- name: app
image: xxx:latest
volumeMounts:
- name: log-volume
mountPath: /app/logs # The log path of the application.
volumes:
- name: log-volume # Define a volume named log-volume.
persistentVolumeClaim:
claimName: pvc-xxx
apiVersion: v1
kind: Pod
metadata:
labels:
app-type: long-term
spec:
containers:
- name: app
image: xxx:latest
volumeMounts:
- name: log-volume
mountPath: /app/logs # The log path of the application.
- name: log-collector
image: xxx:latest
volumeMounts:
- name: log-volume
mountPath: /var/log
volumes:
- name: log-volume # Define a volume named log-volume.
persistentVolumeClaim:
claimName: pvc-xxx

Summary

Original Source:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com