NetApp / trident

Storage orchestrator for containers
Apache License 2.0
760 stars 222 forks source link

The iscsid daemon does not start on Ubuntu 18.04 #353

Closed ysakashita closed 4 years ago

ysakashita commented 4 years ago

Describe the solution you'd like

I set up Ubuntu 18.04 according to the following documentation.

https://github.com/NetApp/trident/blob/master/docs/kubernetes/operations/tasks/worker.rst

NetApp/Trident installation succeeds. However, a volume is not mounted on Pod. Because, it is necessary to discover target port with iscsiadm command before starting open-iscsi service in Ubuntu 18.04. If you do not do this, the iscsid daemon will not start. This was not needed in Ubuntu 16.04. Please see the Ubuntu documents.

https://help.ubuntu.com/lts/serverguide/iscsi-initiator.html

Could you fix the documentation on the correct setup method for Ubuntu 18.04?

scaleoutsean commented 4 years ago

At the top of that worker.rst page it states "All of the worker nodes in the Kubernetes cluster need to be able to mount the volumes that users have provisioned for their pods."

If you follow those instructions and try to mount volumes from your eventual iSCSI portal, you have to run iscsiadm discovery. That hasn't changed and isn't new - it was the same way in Ubuntu 16.04 and before (see https://github.com/open-iscsi/open-iscsi/blob/master/README).

My guess is before (with Ubuntu 16.04) you had already used the same portal prior to using Trident, so the only difference is you didn't notice that you had to do that step and incidentally, you could skip it without noticing that.

ysakashita commented 4 years ago

The difference point between Ubuntu 16.04 and 18.04 is the configuration of systemd.  

[Unit]
Description=Login to default iSCSI targets
Documentation=man:iscsiadm(8) man:iscsid(8)
Wants=network-online.target remote-fs-pre.target iscsid.service
After=network-online.target iscsid.service
Before=remote-fs-pre.target
DefaultDependencies=no
Conflicts=shutdown.target
Before=shutdown.target

[Service]
Type=oneshot
RemainAfterExit=true
# iscsiadm --login will return 21 if no nodes are configured,
# and 15 if a session is alread logged in (which we do not
# consider an error)
SuccessExitStatus=15 21
# iscsiadm will only work if iscsid is running. But we can't use a
# Requires= dependency, since restarts of iscsid would then be
# propagated to this service - and that would cause all sorts of
# mayhem. Therefore, check it in ExecStartPre.
ExecStartPre=/bin/systemctl --quiet is-active iscsid.service
ExecStart=/sbin/iscsiadm -m node --loginall=automatic
ExecStart=/lib/open-iscsi/activate-storage.sh
ExecStop=/lib/open-iscsi/umountiscsi.sh
ExecStop=/bin/sync
ExecStop=/lib/open-iscsi/logout-all.sh
...
[Unit]
Description=Login to default iSCSI targets
Documentation=man:iscsiadm(8) man:iscsid(8)
Wants=network-online.target remote-fs-pre.target
After=network-online.target iscsid.service
Before=remote-fs-pre.target
DefaultDependencies=no
Conflicts=shutdown.target
Before=shutdown.target
# Must have some pre-defined targets to login to
ConditionDirectoryNotEmpty=|/etc/iscsi/nodes
# or have a session to use via iscsid
ConditionDirectoryNotEmpty=|/sys/class/iscsi_session

[Service]
Type=oneshot
RemainAfterExit=true
# iscsiadm --login will return 21 if no nodes are configured,
# and 15 if a session is alread logged in (which we do not
# consider an error)
SuccessExitStatus=15 21
# Note: iscsid will be socket activated by iscsiadm
ExecStart=/sbin/iscsiadm -m node --loginall=automatic
ExecStart=/lib/open-iscsi/activate-storage.sh
ExecStop=/lib/open-iscsi/umountiscsi.sh
ExecStop=/bin/sync
ExecStop=/lib/open-iscsi/logout-all.sh
...

Therefore, the iscsid doesn't work on Ubuntu 18.04 by just setting the NetApp/Trident documentation.

https://netapp-trident.readthedocs.io/en/latest/kubernetes/operations/tasks/worker.html#iscsi

As you know, we need to run iscsiadm discovery or change /etc/systemd/system/iscsi.service. So, I think the better way is update the document for all trident user.

gnarl commented 4 years ago

The documentation will be updated with the Trident 20.07 release.