Changes

3,849 bytes added ,  06:37, 13 December 2025
m
Line 1: Line 1: −
Container checkpointing was introduced as an alpha feature in Kubernetes v1.25 and graduated to beta in Kubernetes v1.30. This functionality allows running containers to be transparently checkpointed to persistent storage and later restored to resume execution, or migrated across nodes and clusters. The content of container checkpoints can be further analyzed with the [https://github.com/checkpoint-restore/checkpointctl checkpointctl] tool. This allows to perform forensic analysis in case of security incidents (e.g., suspected compromise, data exfiltration) or application failures by inspecting the saved process memory, open files, sockets, and execution context captured in the checkpoint.
+
[[Image:K8s-cr-arch-v2.png|right|500px|thumb|Overview of container checkpoint/restore in Kubernetes.]]
 +
 
 +
Container checkpointing was introduced as an alpha feature in Kubernetes v1.25 and graduated to beta in Kubernetes v1.30. This functionality allows running containers to be transparently checkpointed to persistent storage and later restored to resume execution, or migrated across nodes and clusters.
 +
 
 +
The content of container checkpoints can be further analyzed with the [https://github.com/checkpoint-restore/checkpointctl checkpointctl] tool. This allows to perform forensic analysis in case of security incidents (e.g., suspected compromise, data exfiltration) or application failures by inspecting the saved process memory, open files, sockets, and execution context captured in the checkpoint.
 +
 
 +
This feature is developed as a community-driven effort at the [https://github.com/kubernetes/community/tree/master/wg-checkpoint-restore Kubernetes Checkpoint/Restore Working Group]. If you want to get more involved by contributing to Kubernetes, join our [https://groups.google.com/a/kubernetes.io/g/wg-checkpoint-restore mailing list] and Slack channel at [https://kubernetes.slack.com/messages/wg-checkpoint-restore #wg-checkpoint-restore].
    
== Kubelet Checkpoint API ==
 
== Kubelet Checkpoint API ==
Line 66: Line 72:  
   -X POST "https://localhost:10250/checkpoint/default/counters/counter"
 
   -X POST "https://localhost:10250/checkpoint/default/counters/counter"
 
</pre>
 
</pre>
 +
 +
Once the checkpoint has been created, it should be available at <code>/var/lib/kubelet/checkpoints/checkpoint-<pod>_<namespace>-<container>-<timestamp>.tar</code>
    
=== Forensic Analysis ===
 
=== Forensic Analysis ===
Line 94: Line 102:  
==== Low-level Analysis ====
 
==== Low-level Analysis ====
   −
The <code>inspect</code> command can be used to perform low-level analysis of the checkpoint data.
+
The <code>checkpointctl inspect</code> command can be used to perform low-level analysis of the checkpoint data.
    
<pre>
 
<pre>
Line 138: Line 146:  
                 └── [root]  /
 
                 └── [root]  /
 
</pre>
 
</pre>
 +
 +
==== Memory Forensics ====
 +
 +
The <code>checkpointctl memparse</code> command can be used to analyze the memory pages of individual processes in the container checkpoint. When used without any options, this command will display a table with an overview of the processes: their names, IDs, and memory sizes. The <code>--pid</code> option can be used to specify a process to analyze. The <code>--search</code> and <code>--search-regex</code> options can be used to search for a string or regex pattern in the memory pages.
 +
 +
== Restoring Container within Kubernetes ==
 +
 +
To restore a checkpointed container in Kubernetes it is necessary to convert the checkpoint archive into an OCI image that can be pushed to a registry.
 +
 +
=== Creating an OCI Image from a Checkpoint ===
 +
 +
The <code>checkpointctl build</code> command creates an OCI image from a checkpoint archive. It extracts container metadata from the checkpoint and uses [https://github.com/containers/buildah Buildah] to create an annotated image so the container runtime recognizes that it contains a checkpoint.
 +
<pre>
 +
checkpointctl build checkpoint.tar quay.io/foo/bar:latest
 +
</pre>
 +
 +
Once the image has been created, it can be pushed to a container registry:
 +
<pre>
 +
buildah push quay.io/foo/bar:latest
 +
</pre>
 +
 +
=== Restoring Container ===
 +
 +
To restore a container from a checkpoint, specify the OCI image containing the checkpoint in the container's <code>image</code> field. When creating a container, CRI-O and containerd detect OCI images with a checkpoint annotation and, instead of a normal start, restore it from the checkpoint. The following example shows how the YAML file used above can be modified to restore the container from a checkpoint:
 +
 +
<pre>
 +
cat > restore-pod.yaml <<'EOF'
 +
apiVersion: v1
 +
kind: Pod
 +
metadata:
 +
  name: counters
 +
spec:
 +
  containers:
 +
    - name: counter
 +
      image: quay.io/foo/bar:latest  # Replace with checkpoint image URI
 +
EOF
 +
 +
kubectl apply -f restore-pod.yaml
 +
</pre>
 +
 +
== Related Publications, Talks & Blog Posts ==
 +
* Research Papers
 +
** [https://radostin.io/files/vspisakova-jsspp25.pdf Kubernetes Scheduling with Checkpoint/Restore: Challenges and Open Problems]
 +
** [https://doi.org/10.48550/arXiv.2502.16631 CRIUgpu: Transparent Checkpointing of GPU-Accelerated Workloads]
 +
** [https://doi.org/10.1145/3678015.3680477 Towards Efficient End-to-End Encryption for Container Checkpointing Systems]
 +
 +
* KubeCon & CloudNative Talks
 +
** [https://kccnceu2025.sched.com/event/1tx7i Efficient Transparent Checkpointing of AI ML Workloads in Kubernetes]
 +
** [https://sched.co/1dCVs End-to-End Encryption for Container Checkpointing in Kubernetes]
 +
** [https://sched.co/1YeT4 Enabling Coordinated Checkpointing for Distributed HPC Applications]
 +
 +
* Kubernetes Blog Articles
 +
** [https://kubernetes.io/blog/2023/03/10/forensic-container-analysis/ Forensic Container Analysis]
 +
** [https://kubernetes.io/blog/2022/12/05/forensic-container-checkpointing-alpha/ Forensic Container Checkpointing in Kubernetes]
 +
 +
* NVIDIA Technical Blog
 +
** [https://developer.nvidia.com/blog/checkpointing-cuda-applications-with-criu Checkpointing CUDA Applications with CRIU]
571

edits