Can't start iscsiadm inside rkt container on CoreOS

6/20/2016

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.

-- SerCe
coreos
iscsi
kubernetes
openebs
rkt

2 Answers

9/24/2018

It doesn't look like they'll add it default into CoreOS but you can add it in the ignition config. The iscsid-initiatorname.service will create the name for you.

  "storage": {
    "files": [{
      "filesystem": "root",
      "path": "/etc/modules-load.d/iscsi_tcp.conf",
      "contents": { "source": "data:iscsi_tcp" },
      "mode": 420
    }]
  },
  "systemd": {
    "units": [{
        "enable": true,
        "name": "iscsid-initiatorname.service"
    }]
  }

This only works on a fresh install or fresh root disk so create the file, do modprode iscsi_tcp, and do systemctl start iscsid-initiatorname.service if you don't want to start with clean root.

Then if you're using kubernetes just setup the volume mappings:

  kubelet:
    extra_args:
      feature-gates: MountPropagation=true

    extra_binds:
      - /usr/sbin/iscsiadm:/usr/sbin/iscsiadm
      - /usr/sbin/iscsid:/usr/sbin/iscsid
      - /etc/iscsi/:/etc/iscsi/

This got OpenEBS working on my baremetal CoreOS cluster.

-- KRavEN
Source: StackOverflow

6/20/2016

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.

-- SerCe
Source: StackOverflow