Configure DaemonSet upgrade models for ACK edge clusters

更新时间:
复制 MD 格式

In edge computing scenarios, native DaemonSet upgrades may block when cloud-edge links fail and nodes become NotReady, or when you need on-demand upgrades on edge nodes without cloud-driven rollout. Configure the extended AdvancedRollingUpdate or OTA models to resolve upgrade blocking and support over-the-air updates.AdvancedRollingUpdate to skip NotReady nodes during rolling updates, or OTA to trigger per-node upgrades on demand.

Prerequisites

  • An ACK edge cluster running v1.26.3-aliyun.1 or later

Choose an upgrade model

Upgrade model Use when
AdvancedRollingUpdate Cloud-edge disconnections may make nodes NotReady, blocking the rolling update
OTA You want to control upgrade timing per edge node and trigger upgrades on demand via REST API

Configure the upgrade model

Both models require the same DaemonSet annotations and update strategy:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  annotations:
    # Required: enables the extended upgrade model.
    # Valid values: AdvancedRollingUpdate or OTA.
    apps.openyurt.io/update-strategy: AdvancedRollingUpdate
    # Optional: applies to AdvancedRollingUpdate only.
    # Defines the maximum number of unavailable pods during the rolling update.
    # Accepts the same values as the native DaemonSet maxUnavailable. Default: 10%.
    apps.openyurt.io/max-unavailable: 30%
spec:
  updateStrategy:
    # Required: must be set to OnDelete for either upgrade model to take effect.
    type: OnDelete

Set apps.openyurt.io/update-strategy to AdvancedRollingUpdate or OTA, and set spec.updateStrategy.type to OnDelete.

Parameters

Parameter Description
apps.openyurt.io/update-strategy Enables the extended upgrade model. Valid values: AdvancedRollingUpdate or OTA.
apps.openyurt.io/max-unavailable Applies to AdvancedRollingUpdate only. Maximum unavailable pods during rolling update. Same values as native DaemonSet maxUnavailable. Default: 10%.
spec.updateStrategy.type Must be set to OnDelete. Manually delete old pods to trigger new pod creation.

Use AdvancedRollingUpdate

AdvancedRollingUpdate skips NotReady nodes and upgrades pods on Ready nodes first. When a node becomes Ready again, its DaemonSet pod is upgraded automatically.

This example creates a DaemonSet nginx-daemonset with AdvancedRollingUpdate and 30% max unavailable pods.

cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: nginx-daemonset
  annotations:
    apps.openyurt.io/update-strategy: AdvancedRollingUpdate
    apps.openyurt.io/max-unavailable: 30%
spec:
  selector:
    matchLabels:
      app: nginx
  updateStrategy:
    type: OnDelete
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.19.4
EOF
Pods on NotReady nodes are skipped. When a node becomes Ready, its DaemonSet pod is upgraded automatically.

Use OTA

OTA lets you control upgrade timing per edge node. After a DaemonSet image update, pods are not upgraded automatically. Use edge-hub REST APIs on each node to check status and trigger upgrades.

OTA REST APIs

All API calls are made locally on the edge node (base URL: http://127.0.0.1:10267).

Method Endpoint Description
GET /pods Returns pod information. Check PodNeedUpgrade in Pod.status.conditions to identify pods that need upgrading.
POST /openyurt.io/v1/namespaces/{ns}/pods/{podname}/imagepull Pre-pulls the image for a DaemonSet pod to reduce upgrade startup time. Supported in v1.32-aliyun.1 or later.
POST /openyurt.io/v1/namespaces/{ns}/pods/{podname}/upgrade Triggers an upgrade for a DaemonSet pod.

OTA upgrade example

Step 1: Create an OTA-enabled DaemonSet

cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: nginx-daemonset
  annotations:
    apps.openyurt.io/update-strategy: OTA
spec:
  selector:
    matchLabels:
      app: nginx
  updateStrategy:
    type: OnDelete
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.19.4
EOF

Step 2: Update the DaemonSet image

Update the DaemonSet image. Pods on edge nodes are not upgraded automatically.

kubectl set image daemonset/nginx-daemonset nginx=nginx:1.19.5

Step 3: Check whether a pod needs an upgrade

On an edge node, list pod status:

curl http://127.0.0.1:10267/pods

If default/nginx-daemonset-bwzss shows PodNeedUpgrade=true in pod.Status.Conditions, the pod needs an upgrade.

Step 4: (Optional) Pre-pull the image

For large images, pre-pull the image to reduce startup time:

curl -X POST http://127.0.0.1:10267/openyurt.io/v1/namespaces/default/pods/nginx-daemonset-bwzss/imagepull

Expected output:

Image pre-pull requested for pod default/nginx-daemonset-bwzss
The image pre-pull API requires cluster version v1.32-aliyun.1 or later.

Step 5: Trigger the upgrade

curl -X POST http://127.0.0.1:10267/openyurt.io/v1/namespaces/default/pods/nginx-daemonset-bwzss/upgrade

Expected output:

Start updating pod default/nginx-daemonset-bwzss

Next steps