Difference between revisions of "Kubernetes"

From CRIU
Jump to navigation Jump to search
m
m
Line 8: Line 8:
 
curl -X POST "https://localhost:10250/checkpoint/<Namespace>/<Pod>/<Container>"
 
curl -X POST "https://localhost:10250/checkpoint/<Namespace>/<Pod>/<Container>"
 
</pre>
 
</pre>
 +
 +
Triggering this kubelet API will request the creation of a checkpoint from the container runtime (e.g., containerd or CRI-O). In tern, the container runtime requests a checkpoint from the low-level runtime (e.g., <code>runc</code>) that invokes CRIU.
  
 
=== Example ===
 
=== Example ===

Revision as of 14:25, 7 November 2025

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 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.

Kubelet Checkpoint API

This functionality is exposed through a node-local kubelet checkpoint API (enabled by default in Kubernetes v1.30). A checkpoint can be triggered by sending an HTTP POST Request to the kubelet as follows:

curl -X POST "https://localhost:10250/checkpoint/<Namespace>/<Pod>/<Container>"

Triggering this kubelet API will request the creation of a checkpoint from the container runtime (e.g., containerd or CRI-O). In tern, the container runtime requests a checkpoint from the low-level runtime (e.g., runc) that invokes CRIU.

Example

1. Create a Pod

cat > pod.yaml <<EOF
apiVersion: v1
kind: Pod
metadata:
  name: counters
spec:
  containers:
    - name: counter
      image: busybox:latest
      command: ['sh', '-c', 'i=0; while true; do echo $i; i=$((i+1)); sleep 1; done']
EOF
kubectl apply -f pod.yaml

2. Create a container checkpoint

curl -X POST "https://localhost:10250/checkpoint/default/counters/counter"