Search code examples
kubernetescoreosiscsiopenebsrkt

Can't start iscsiadm inside rkt container on CoreOS


I'm trying to start kubernetes with an iscsi plugin inside rkt on CoreOS using the instruction here. The problem is the iscsi daemon can't start, so I'm getting an error and can't mount the volume to the pod.

iscsi_util.go:112] iscsi: failed to sendtargets to portal 156.64.48.59:3260 
    error: iscsiadm: Failed to load module tcp: No such file
iscsiadm: Could not load transport tcp.Dropping interface default.
[disk_manager.go:50] failed to attach disk 
iscsi: failed to setup
kubelet.go:1780] Unable to mount volumes for pod ...

I tried to mount the whole /dev/ inside the rkt container, but it doesn't help me.


Solution

  • To get a working solution I had to:

    • Change RKT options to

      RKT_OPTS=--volume=iscsiadm,kind=host,source=/usr/sbin/iscsiadm --mount volume=iscsiadm,target=/usr/sbin/iscsiadm --volume=resolv,kind=host,source=/etc/resolv.conf --mount volume=resolv,target=/etc/resolv.conf --volume=etcs,kind=host,source=/etc/iscsi/ --mount volume=etcs,target=/etc/iscsi --volume=iscsid,kind=host,source=/usr/sbin/iscsid --mount volume=iscsid,target=/usr/sbin/iscsid

    • sudo modprobe iscsi_tcp

    Initialize tcp module in advance because it needed for ascsiadm. But CoreOS loads modules "as-needed" and by some reasons it doesn't work inside rkt container.

    • echo "InitiatorName=iqn.2001-12.com.mycompany:volume.openiscsi-initiator" > /etc/iscsi/initiatorname.iscsi

    At least some initiator name is needed.

    I also filled the bug in CoreOS, maybe a better workaround exists.