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