This repository implements persistent writable container root filesystems by combining three existing control points without patching Kubernetes or containerd:
- Kubernetes CSI publishes a normal PVC to the Pod.
- An admission webhook injects a dedicated RuntimeClass and hides the PVC at a reserved mount path.
- A containerd Runtime v2 shim uses the containerd snapshot as OverlayFS
lowerdirand the CSI volume asupperdir/workdir.
Writes to ordinary paths such as /opt, /usr/local, or /home survive
container and Pod recreation. Kubernetes-managed mounts such as Secrets,
ConfigMaps, /proc, and other PVC mounts retain their normal semantics.
This is an engineering preview targeting containerd 1.6/1.7 (make shim-1x)
and 2.1.x (make shim) on Linux. It is
suitable for controlled test nodes and single-replica stateful workloads. Read
the architecture and the usage guide
before deploying it.
The example StatefulSet requests a
Filesystem PVC with ReadWriteOncePod access. Its storageClassName,
csi-rbd-sc-nvme, is an example, not a required class name. Before applying
the manifest, set it to a CSI StorageClass in your cluster that supports this
access mode and provisions an OverlayFS-compatible filesystem.
make test
make shim
make webhook
make webhook-image IMAGE=registry.example/persistent-rootfs-webhook:v0.1.0Outputs:
build/containerd-shim-persistent-v2
build/persistent-rootfs-webhook
Branch and tag pushes, merge requests, and manual web pipelines run Linux tests
before building both shim variants and the webhook. Feature branches with an
open merge request use the merge request pipeline instead of a duplicate push
pipeline. make test includes the mock installer suite on Linux; the webhook
also runs under the Go race detector. The build job retains the three binaries
for one week. It does not publish images or deploy to a cluster.
Use a Linux amd64 container runner with access to Go modules and the build
image. Set the GitLab CI/CD variable BUILD_IMAGE to use an internal Go 1.25
mirror if needed; it must include Make, Bash, OpenSSL, and a C compiler for the
race detector. No privileged runner is required for this pipeline. The real
OverlayFS mount test may skip without mount privileges; cluster and storage
acceptance remains a separate step (see recovery acceptance).
cmd/containerd-shim-persistent-v2 containerd Runtime v2 shim
cmd/persistent-rootfs-webhook Pod admission webhook
internal/persistentrootfs OCI, mount, lease, and admission logic
deploy node and Kubernetes deployment assets
docs architecture and operations guides