I would like to ask if you have any experience with running urunc on k3s. I have tried installing urunc on a k3s node, but I have run into a couple of issues.
System info
- Urunc version: 0.2.0-b19d412
- Arch: x86_64
- Unikernel: nubificus/nginx-hvt:x86_64
- k3s: v1.30.4+k3s1 (98262b5d)
If I install urunc with the way it is described on installation.md, then urunc won't be a known runtime for kublet and get stuck on ContainerCreating
So I tried doing the following:
- do not install runc
- do not install containerd
- do not install container.service
- configure /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl to add the urunc plugin
- installed cni plugins and put them inside /var/lib/rancher/k3s/agent/etc/cni
- do not install nerdctl
- setup thinpool devmapper by modifying dm_create.sh and dm_reload.sh
- do not install solo5, qemu or firecracker
I will list now the files that I modified and what they contain:
dm_create.sh:
#!/bin/bash
DATA_DIR=/var/lib/rancher/k3s/agent/containerd/io.containerd.snapshotter.v1.devmapper
POOL_NAME=containerd-pool
mkdir -p /var/lib/rancher/k3s/agent/containerd/
mkdir -p ${DATA_DIR}
# Create data file
touch "${DATA_DIR}/data"
truncate -s 100G "${DATA_DIR}/data"
# Create metadata file
touch "${DATA_DIR}/meta"
truncate -s 10G "${DATA_DIR}/meta"
# Allocate loop devices
DATA_DEV=$(losetup --find --show "${DATA_DIR}/data")
META_DEV=$(losetup --find --show "${DATA_DIR}/meta")
# Define thin-pool parameters.
# See https://www.kernel.org/doc/Documentation/device-mapper/thin-provisioning.txt for details.
SECTOR_SIZE=512
DATA_SIZE="$(blockdev --getsize64 -q ${DATA_DEV})"
LENGTH_IN_SECTORS=$(bc <<<"${DATA_SIZE}/${SECTOR_SIZE}")
DATA_BLOCK_SIZE=128
LOW_WATER_MARK=32768
# Create a thin-pool device
dmsetup create "${POOL_NAME}" \
--table "0 ${LENGTH_IN_SECTORS} thin-pool ${META_DEV} ${DATA_DEV} ${DATA_BLOCK_SIZE} ${LOW_WATER_MARK}"
dm_reload.sh
#!/bin/bash
set -ex
DATA_DIR=/var/lib/rancher/k3s/agent/containerd/io.containerd.snapshotter.v1.devmapper
POOL_NAME=containerd-pool
# Allocate loop devices
DATA_DEV=$(losetup --find --show "${DATA_DIR}/data")
META_DEV=$(losetup --find --show "${DATA_DIR}/meta")
# Define thin-pool parameters.
# See https://www.kernel.org/doc/Documentation/device-mapper/thin-provisioning.txt for details.
SECTOR_SIZE=512
DATA_SIZE="$(blockdev --getsize64 -q ${DATA_DEV})"
LENGTH_IN_SECTORS=$(bc <<<"${DATA_SIZE}/${SECTOR_SIZE}")
DATA_BLOCK_SIZE=128
LOW_WATER_MARK=32768
# Create a thin-pool device
dmsetup create "${POOL_NAME}" \
--table "0 ${LENGTH_IN_SECTORS} thin-pool ${META_DEV} ${DATA_DEV} ${DATA_BLOCK_SIZE} ${LOW_WATER_MARK}"
systemctl restart containerd.service
/var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl
{{ template "base" . }}
[plugins."io.containerd.snapshotter.v1.devmapper"]
pool_name = "containerd-pool"
root_path = "/var/lib/rancher/k3s/agent/containerd/io.containerd.snapshotter.v1.devmapper"
base_image_size = "10GB"
discard_blocks = true
fs_type = "ext2"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.urunc]
runtime_type = "io.containerd.urunc.v2"
container_annotations = ["com.urunc.unikernel.*"]
pod_annotations = ["com.urunc.unikernel.*"]
snapshotter = "devmapper"
After all these changes, I am currently facing this error:
Name: nginx-urunc-545b984cdd-69xql
Namespace: default
Priority: 0
Runtime Class Name: urunc
Service Account: default
Node: tt-node1/10.9.2.165
Start Time: Tue, 27 Aug 2024 13:33:22 +0000
Labels: pod-template-hash=545b984cdd
run=nginx-urunc
Annotations: <none>
Status: Pending
IP:
IPs: <none>
Controlled By: ReplicaSet/nginx-urunc-545b984cdd
Containers:
nginx-urunc:
Container ID:
Image: nubificus/nginx-hvt:x86_64
Image ID:
Port: 80/TCP
Host Port: 0/TCP
Command:
sleep
Args:
infinity
State: Waiting
Reason: ContainerCreating
Ready: False
Restart Count: 0
Requests:
cpu: 10m
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-t48dd (ro)
Conditions:
Type Status
PodReadyToStartContainers False
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
kube-api-access-t48dd:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional: <nil>
DownwardAPI: true
QoS Class: Burstable
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedCreatePodSandBox 6s (x2 over 18s) kubelet Failed to create pod sandbox: rpc error: code = NotFound desc = failed to create containerd container: snapshot does not exist: not found
And the container is stuck on ContainerCreating.
The deplyoment yaml I use is:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
run: nginx-urunc
name: nginx-urunc
spec:
replicas: 1
selector:
matchLabels:
run: nginx-urunc
template:
metadata:
labels:
run: nginx-urunc
spec:
nodeName: tt-node1
runtimeClassName: urunc
containers:
- image: nubificus/nginx-hvt:x86_64
imagePullPolicy: Always
name: nginx-urunc
command: ["sleep"]
args: ["infinity"]
ports:
- containerPort: 80
protocol: TCP
resources:
requests:
cpu: 10m
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: nginx-urunc
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
run: nginx-urunc
sessionAffinity: None
type: ClusterIP
And the runtimeClass yaml is
kind: RuntimeClass
apiVersion: node.k8s.io/v1
metadata:
name: urunc
handler: urunc
Thank you in advance!
I would like to ask if you have any experience with running urunc on k3s. I have tried installing urunc on a k3s node, but I have run into a couple of issues.
System info
If I install urunc with the way it is described on installation.md, then urunc won't be a known runtime for kublet and get stuck on ContainerCreating
So I tried doing the following:
I will list now the files that I modified and what they contain:
dm_create.sh:
dm_reload.sh
/var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl
After all these changes, I am currently facing this error:
And the container is stuck on ContainerCreating.
The deplyoment yaml I use is:
And the runtimeClass yaml is
Thank you in advance!