Search code examples
dockerkubernetesiscsi

Unable to login in iscsi initiator in docker container within a kubernetes cluster


Unable to login in iscsi initiator in docker container running inside a kubernetes cluster

I have installed open-iscsi package in a docker ubuntu container with privileged mode inside a kubeminion. The iscsi target is running and the iscsi initiator discovery returns the correct initiator name iqn. When I try to login, I get this:

ERROR : iscsiadm: got read error (0/111), daemon died? iscsiadm: Could not login to [iface: default, target: iqn.2016-09.com.abcdefg.xyza:name, portal: 10.102.83.21,3260]. iscsiadm: initiator reported error (18 - could not communicate to iscsid) iscsiadm: Could not log into all portals

I tried service iscsid restart and debug with iscsid -d 8 -f command, still login is not successful


Solution

  • Adding --net=host flag and --privileged flag while docker run within the cluster, both iscsi discover and login will be successful. iscsi expects host's networking services to run with privileged access. The command should be, docker run -it --privileged --net=host name:tag With the network set to host a container will share the host’s network stack and all interfaces from the host will be available to the container. The container’s hostname will match the hostname on the host system.

    For more details, refer the documentation : https://docs.docker.com/engine/reference/run/#network-settings

    Note:Flag --net works on older and latest versions of docker, --network works on latest docker version only.