adamant-kite-43734
08/25/2025, 6:35 PMhundreds-evening-84071
08/25/2025, 7:06 PMrough-actor-44204
08/25/2025, 7:09 PMdev-k8re-01:/var/lib # ls -lZ | grep rancher
drwxr-xr-x. 1 root root unconfined_u:object_r:var_lib_t:s0 6 Aug 25 12:14 rancherhundreds-evening-84071
08/25/2025, 7:31 PMrough-actor-44204
08/25/2025, 7:38 PMstorage has the container_file_t context on the systems that run fine, and k3s_data_t on the systems that fail.hundreds-evening-84071
08/25/2025, 7:40 PMrough-actor-44204
08/25/2025, 7:43 PMrough-actor-44204
08/25/2025, 8:17 PMchcon system_u:object_r:container_file_t:s0 /var/lib/rancher/k3s/data/storage/ immediately after k3s is installed because I guess I ran into this issue before and forgot. I disabled that and let the default stay: system_u:object_r:k3s_data_t:s0
After rebooting, the local provisioner helper pods start failing again due to the OP selinux issue.rough-actor-44204
08/25/2025, 8:20 PMrough-actor-44204
08/26/2025, 3:01 PM#!/usr/bin/env bash
mount /var
curl -fsSL -o /usr/bin/yq <https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64>
chmod +x /usr/bin/yq
export INSTALL_K3S_BIN_DIR=/usr/bin
export INSTALL_K3s_SKIP_START=true
curl -fsSL <https://get.k3s.io> |
sed 's#k3s >/.*#k3s; then#' | \
sh -s - server \
--disable=traefik \
--disable=servicelb \
--disable=local-storage \
--node-name=pvctest \
--selinux
kdir=/var/lib/rancher/k3s
k3sm=${kdir}/server/manifests
lsim=${k3sm}/local-storage-im.yaml
mkdir -p ${k3sm}
curl -fsSL -o ${lsim} <https://raw.githubusercontent.com/k3s-io/k3s/refs/heads/master/manifests/local-storage.yaml>
yq -i '. |= with(select(.kind == "StorageClass"); .volumeBindingMode = "Immediate" )' ${lsim}
sed -i "s/%{SYSTEM_DEFAULT_REGISTRY}%//" ${lsim}
sed -i "s#%{DEFAULT_LOCAL_STORAGE_PATH}%#${kdir}/data/storage#" ${lsim}
cat <<EOF > ${k3sm}/pvctest.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
<http://volume.kubernetes.io/selected-node|volume.kubernetes.io/selected-node>: pvctest
name: pvctest
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: local-path
volumeMode: Filesystem
EOFrough-actor-44204
08/26/2025, 3:03 PMscript.sh , make it executable, then run transactional-update run ./script.sh and reboot. After the system comes back up you can see that the local-provisioner helper pod is failing to create the volume.average-appointment-24470
08/26/2025, 7:01 PM# Rule 3: Allow the container runtime to manage its storage directory.
# This grants the necessary permissions for the local-path-provisioner
# to create, modify, and delete directories and files within its storage path.
allow container_runtime_t var_lib_t:dir { add_name create getattr setattr search write remove_name };
allow container_runtime_t var_lib_t:file { create setattr unlink write };
Saw one of my clusters running this custom policy to fix local path provisioner errors 🙂