Fix iscsi-multipath-init DaemonSet for Talos read-only filesystem

Use nsenter to write multipath.conf in host's mount namespace instead
of trying to write to /host/etc which is read-only in containers.

Talos mounts /etc as read-only in container namespaces but allows writes
in the host mount namespace. This fix uses nsenter to access PID 1's
mount namespace where /etc is writable.

Also removed unnecessary volumeMounts and volumes since we're using
nsenter instead of hostPath mounts.

Fixes: Init:Error - 'can't create /host/etc/multipath.conf: Read-only file system'
This commit is contained in:
Hermes Agent service account
2026-06-20 23:56:20 -05:00
parent 150cef1aca
commit 002d6799b1

View File

@@ -51,8 +51,9 @@ spec:
echo "Configuring multipath for Pure Storage FlashArray..." echo "Configuring multipath for Pure Storage FlashArray..."
# Write multipath.conf # Write multipath.conf using nsenter to access host's writable filesystem
cat > /host/etc/multipath.conf <<'MPCONF' # Talos mounts /etc as read-only in containers, but writable in host namespace
nsenter -t 1 -m -u -i -n -- sh -c 'cat > /etc/multipath.conf' <<'MPCONF'
# Multipath configuration for Pure Storage FlashArray # Multipath configuration for Pure Storage FlashArray
# Managed by iscsi-multipath-init DaemonSet # Managed by iscsi-multipath-init DaemonSet
@@ -97,10 +98,6 @@ spec:
echo "✓ Multipath configuration complete" echo "✓ Multipath configuration complete"
echo "Current multipath devices:" echo "Current multipath devices:"
nsenter -t 1 -m -u -i -n -- multipath -ll || echo " (no multipath devices yet)" nsenter -t 1 -m -u -i -n -- multipath -ll || echo " (no multipath devices yet)"
volumeMounts:
- name: host-etc
mountPath: /host/etc
containers: containers:
# Pause container keeps the pod running to indicate configuration is applied # Pause container keeps the pod running to indicate configuration is applied
@@ -113,9 +110,3 @@ spec:
limits: limits:
cpu: 10m cpu: 10m
memory: 16Mi memory: 16Mi
volumes:
- name: host-etc
hostPath:
path: /etc
type: Directory