Skip to content

Commit a6b6ae8

Browse files
amalthundiyilvvolkl
authored andcommitted
Add example for using cvmfs-snapshotter with k3s (#234)
* fix formatting errors Signed-off-by: Amal Thundiyil <[email protected]> * add example for using cvmfs-snapshotter with k3s Signed-off-by: Amal Thundiyil <[email protected]> --------- Signed-off-by: Amal Thundiyil <[email protected]>
1 parent e831065 commit a6b6ae8

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

cpt-containers.rst

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,9 @@ By default, the repository used to search for the layers is ``unpacked.cern.ch``
238238
The default values can be overwritten in the ``config.toml`` file using the ``--config`` option.
239239
A template ``config.toml`` file looks like this:
240240

241-
::
241+
.. code-block:: toml
242+
243+
# /etc/containerd/config.toml
242244
243245
version = 2
244246
@@ -258,10 +260,58 @@ A template ``config.toml`` file looks like this:
258260
address = "/run/containerd-cvmfs-grpc/containerd-cvmfs-grpc.sock"
259261
260262
263+
.. code-block:: toml
264+
265+
# /etc/containerd-cvmfs-grpc/config.toml
266+
267+
268+
# Source of image layers
269+
repository = "unpacked.cern.ch"
270+
absolute-mountpoint = "/cvmfs/unpacked.cern.ch"
271+
261272
Note that if only the repository is specified under the key value ``repository``, the mountpoint
262273
(under the key value ``absolute-mountpoint``) is by default constructed as ``/cvmfs/<repo_name>``.
263274

264275

276+
Running with k3s
277+
^^^^^^^^^^^^^^^^
278+
To configure k3s, edit ``/var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl`` with the following content:
279+
280+
.. code-block:: toml
281+
282+
version = 2
283+
[plugins."io.containerd.grpc.v1.cri".containerd]
284+
snapshotter = "cvmfs-snapshotter"
285+
disable_snapshot_annotations = false
286+
[proxy_plugins]
287+
[proxy_plugins.cvmfs-snapshotter]
288+
type = "snapshot"
289+
address = "/run/containerd-cvmfs-grpc/containerd-cvmfs-grpc.sock"
290+
[plugins."io.containerd.grpc.v1.cri".cni]
291+
bin_dir = "/var/lib/rancher/k3s/data/current/bin"
292+
conf_dir = "/var/lib/rancher/k3s/agent/etc/cni/net.d"
293+
294+
After configuration, restart k3s with ``systemctl restart k3s``.
295+
296+
To test, apply this sample pod configuration:
297+
298+
.. code-block:: yaml
299+
300+
apiVersion: v1
301+
kind: Pod
302+
metadata:
303+
name: python-http-server
304+
spec:
305+
containers:
306+
- name: python-server
307+
image: python:3.9
308+
imagePullPolicy: Always
309+
command: ["python", "-m", "http.server", "8000"]
310+
ports:
311+
- containerPort: 8000
312+
313+
Verify the setup using ``kubectl describe`` to check pod details. Note the startup time is about 2-3 seconds, compared to 13 seconds with the default snapshotter. For further verification, check the cvmfs-snapshotter logs using ``journalctl -u cvmfs-snapshotter``.
314+
265315
``podman`` integration (pre-production)
266316
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
267317

0 commit comments

Comments
 (0)