Kubernetes Pod无法安装iSCSI卷:无法获取iscsi磁盘的任何路径

时间:2019-04-30 11:41:53

标签: kubernetes iscsi

我想像此this example一样将iSCSI卷添加到Pod。我已经在Debian服务器上准备了一个iSCSI目标,并在所有工作节点上安装了open-iscsi。我还确认了我可以使用命令行工具(即仍然在Kubernetes外部)将iSCSI目标安装在工作节点上。这很好。为简单起见,目前尚没有身份验证(CHAP),并且目标上已经存在ext4文件系统。

我现在希望Kubernetes 1.14将相同的iSCSI目标安装到具有以下清单的Pod中:

---
apiVersion: v1
kind: Pod
metadata:
  name: iscsipd
spec:
  containers:
  - name: iscsipd-ro
    image: kubernetes/pause
    volumeMounts:
    - mountPath: "/mnt/iscsipd"
      name: iscsivol
  volumes:
  - name: iscsivol
    iscsi:
      targetPortal: 1.2.3.4 # my target
      iqn: iqn.2019-04.my-domain.com:lun1
      lun: 0
      fsType: ext4
      readOnly: true

根据kubectl describe pod,此方法在初始阶段(SuccessfulAttachVolume)有效,但随后失败(FailedMount)。确切的错误消息显示为:

Warning  FailedMount ... Unable to mount volumes for pod "iscsipd_default(...)": timeout expired waiting for volumes to attach or mount for pod "default"/"iscsipd". list of unmounted volumes=[iscsivol]. list of unattached volumes=[iscsivol default-token-7bxnn]
Warning  FailedMount ... MountVolume.WaitForAttach failed for volume "iscsivol" : failed to get any path for iscsi disk, last err seen:
Could not attach disk: Timeout after 10s

如何进一步诊断和克服此问题?

更新this相关问题中,解决方案包括使用数字IP地址作为目标。但是,这对我的情况没有帮助,因为我已经在使用targetPortal形式的1.2.3.4( 也尝试使用端口号3260和不使用端口号3260。

更新停止scsid.service和/或open-iscsi.service(如建议的here)也没有任何作用。

更新如果waitForPathToExist(&devicePath, multipathDeviceTimeout, iscsiTransport)失败,显然会在pkg/volume/iscsi/iscsi_util.go中触发错误。但是,奇怪的是,当触发devicePath/dev/disk/by-path/ip-...-iscsi-...-lun-...)处的文件时,该节点上确实存在该文件。

更新我已经使用以下过程来定义简单的iSCSI目标以进行这些测试:

pvcreate /dev/sdb
vgcreate iscsi /dev/sdb
lvcreate -L 10G -n iscsi_1 iscsi
apt-get install tgt
cat >/etc/tgt/conf.d/iscsi_1.conf <<EOL
<target iqn.2019-04.my-domain.com:lun1>
  backing-store /dev/mapper/iscsi-iscsi_1
  initiator-address 5.6.7.8 # my cluster node #1
  ... # my cluster node #2, etc.
</target>
EOL
systemctl restart tgt
tgtadm --mode target --op show

2 个答案:

答案 0 :(得分:1)

这可能是由于对iscsi目标的身份验证问题。

如果尚未使用CHAP身份验证,则仍然必须禁用身份验证。 例如,如果使用targetcli,则可以运行以下命令来禁用它。

$ sudo targetcli
/> /iscsi/iqn.2003-01.org.xxxx/tpg1 set attribute authentication=0 # will disable auth
/> /iscsi/iqn.2003-01.org.xxxx/tpg1 set attribute generate_node_acls=1 # will force to use tpg1 auth mode by default

如果这对您没有帮助,请分享您的iscsi目标配置,或指导您进行后续操作。

答案 1 :(得分:0)

相关问题