Repository navigation
Add workload to enable deprecated containerd checkpoint restore #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
SergeyKanzhelev
merged 1 commit into
GoogleCloudPlatform:master
from
chrishenzie:containerd-enable-checkpoint-restore
Sep 2, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Re-enable containerd Checkpoint Restore (CreateContainer) | ||
|
|
||
| Starting with containerd 2.2.7 and 2.3.4, checkpoint restore via CRI `CreateContainer` is deprecated and disabled by default, and is removed entirely in containerd 2.4+. For details, see the announcement on the [kubernetes-dev mailing list](https://groups.google.com/a/kubernetes.io/g/dev/c/O420PQSbTn8). | ||
|
|
||
| Standard Kubernetes workloads are unaffected. Workloads that restore container checkpoints (which requires `criu` on the node) fail during container creation with: | ||
|
|
||
| ``` | ||
| rpc error: code = Unknown desc = checkpoint restore via CreateContainer is disabled by configuration | ||
| ``` | ||
|
|
||
| This DaemonSet re-enables the deprecated feature by setting `enable_experimental_restore_via_create = true` in `/etc/containerd/config.toml` and restarting containerd. | ||
|
|
||
| ## Caution | ||
|
|
||
| The containerd project cautions that if restore via `CreateContainer` is enabled, only trusted users should be granted permission to create pods and only trusted values should be specified in the `image:` field of a pod. | ||
|
|
||
| ## Prerequisites & Compatibility | ||
|
|
||
| * **GKE Standard only:** This DaemonSet requires privileged host access to modify `/etc/containerd/config.toml` and restart containerd. It is not supported on GKE Autopilot. | ||
| * **containerd restart:** Deploying this workload restarts the containerd service on each targeted node. | ||
|
|
||
| ## Usage | ||
|
|
||
| Apply the DaemonSet to your cluster: | ||
|
|
||
| ```bash | ||
| kubectl apply -f https://raw.githubusercontent.com/GoogleCloudPlatform/k8s-node-tools/master/containerd/enable-deprecated-checkpoint-restore/enable-deprecated-checkpoint-restore.yaml | ||
| ``` | ||
|
|
||
| Or apply the local file: | ||
|
|
||
| ```bash | ||
| kubectl apply -f enable-deprecated-checkpoint-restore.yaml | ||
| ``` | ||
|
|
||
| ## Verification | ||
|
|
||
| To verify that the deprecation warning is registered when a container creation from a checkpoint image is attempted, run the following command on a node: | ||
|
|
||
| ```bash | ||
| sudo ctr --namespace k8s.io deprecations list | ||
| ``` | ||
|
|
||
| Restored containers also carry runtime annotations in `crictl`: | ||
|
|
||
| ```bash | ||
| sudo crictl ps -a -o json | jq -r ' | ||
| [ .containers[]? | ||
| | select(.annotations.restored == "true") | ||
| | "container=\(.id[0:12]) (pod=\(.labels["io.kubernetes.pod.namespace"] // "unknown")/\(.labels["io.kubernetes.pod.name"] // "unknown")), name=\(.metadata.name // "unknown"), checkpointedAt=\(.annotations.checkpointedAt // "unknown"), checkpointImage=\(.annotations.checkpointImage // "unknown")" | ||
| ] | .[]' | ||
| ``` | ||
|
|
||
| ## Removal | ||
|
|
||
| To remove the DaemonSet: | ||
|
|
||
| ```bash | ||
| kubectl delete -f https://raw.githubusercontent.com/GoogleCloudPlatform/k8s-node-tools/master/containerd/enable-deprecated-checkpoint-restore/enable-deprecated-checkpoint-restore.yaml | ||
| ``` | ||
|
|
||
| Note that removing the DaemonSet does not revert the configuration in `/etc/containerd/config.toml` until the node is recreated or the configuration field is manually removed. | ||
51 changes: 51 additions & 0 deletions
51
containerd/enable-deprecated-checkpoint-restore/enable-deprecated-checkpoint-restore.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| apiVersion: apps/v1 | ||
| kind: DaemonSet | ||
| metadata: | ||
| name: containerd-enable-deprecated-restore | ||
| namespace: kube-system | ||
| labels: | ||
| k8s-app: containerd-enable-deprecated-restore | ||
| spec: | ||
| selector: | ||
| matchLabels: | ||
| name: containerd-enable-deprecated-restore | ||
| template: | ||
| metadata: | ||
| labels: | ||
| name: containerd-enable-deprecated-restore | ||
| k8s-app: containerd-enable-deprecated-restore | ||
| spec: | ||
| hostPID: true | ||
| tolerations: | ||
| - operator: "Exists" | ||
| volumes: | ||
| - name: containerd-config | ||
| hostPath: | ||
| path: /etc/containerd | ||
| type: Directory | ||
| initContainers: | ||
| - name: startup-script | ||
| image: gke.gcr.io/debian-base:bookworm-v1.0.0-gke.1 | ||
| imagePullPolicy: IfNotPresent | ||
| securityContext: | ||
| privileged: true | ||
|
chrishenzie marked this conversation as resolved.
|
||
| volumeMounts: | ||
| - name: containerd-config | ||
| mountPath: /etc/containerd | ||
| command: | ||
| - /bin/sh | ||
| - -c | ||
| - | | ||
| set -e | ||
| set -u | ||
|
|
||
| CONFIG_FILE="/etc/containerd/config.toml" | ||
| if ! grep -q "enable_experimental_restore_via_create" "$CONFIG_FILE"; then | ||
| echo "Enabling enable_experimental_restore_via_create in $CONFIG_FILE..." | ||
| sed -i '/\[plugins\.[^.]*io\.containerd\.[^.]*\(grpc\.v1\.cri\|cri\.v1\.runtime\)[^.]*\]/a \ \ \ \ enable_experimental_restore_via_create = true' "$CONFIG_FILE" | ||
| echo "Restarting containerd..." | ||
| nsenter -t 1 -m -p -- systemctl restart containerd | ||
| fi | ||
| containers: | ||
| - name: pause | ||
| image: gke.gcr.io/pause:3.8 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this say anything about node selector?