簡體   English   中英

Kubernetes pod 無法掛載 iSCSI 卷:無法獲取 iSCSI 磁盤的任何路徑

[英]Kubernetes pod cannot mount iSCSI volume: failed to get any path for iscsi disk

我想在本例中將 iSCSI 卷添加到 pod。 我已經在 Debian 服務器上准備了一個 iSCSI 目標,並在我的所有工作節點上安裝了open-iscsi 我還確認我可以使用命令行工具將 iSCSI 目標掛載到工作節點上(即仍在 Kubernetes 之外)。 這工作正常。 為簡單起見,目前還沒有身份驗證 (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

我怎樣才能進一步診斷和克服這個問題?

更新相關問題中,解決方案包括為目標使用數字 IP 地址。 但是,這對我的情況沒有幫助,因為我已經在使用形式為1.2.3.4targetPortal (也嘗試過使用和不使用端口號 3260)。

更新停止scsid.service和/或open-iscsi.service (如建議在這里)沒有做出任何的區別。

更新如果waitForPathToExist(&devicePath, multipathDeviceTimeout, iscsiTransport)失敗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

這可能是因為您的 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 目標配置或您遵循的指南。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM