【问题标题】:kubernetes create pod with iscsi volumeKubernetes 使用 iSCSI 卷创建 pod
【发布时间】:2018-08-07 17:45:01
【问题描述】:

我是 K8s 的新手,现在我坚持使用 iSCSI 卷创建一个 pod 我使用 openfiler 作为 iscsi 目标,为 K8s 主机节点提供一个 LUN。 我可以通过“multipath -l”看到磁盘:

mpatha (14f504e46494c455265305742724d2d7949544e2d736c4744) dm-3 OPNFILER,VIRTUAL-DISK    
size=1.0G features='0' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=0 status=active
| `- 33:0:0:0 sdb 8:16 active undef unknown
`-+- policy='service-time 0' prio=0 status=enabled
  `- 34:0:0:0 sdc 8:32 active undef unknown

或“cat /proc/scsi/scsi”

Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 2.0 
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi3 Channel: 00 Id: 00 Lun: 00
  Vendor: NECVMWar Model: VMware SATA CD00 Rev: 1.00
  Type:   CD-ROM                           ANSI  SCSI revision: 05
Host: scsi33 Channel: 00 Id: 00 Lun: 00
  Vendor: OPNFILER Model: VIRTUAL-DISK     Rev: 0   
  Type:   Direct-Access                    ANSI  SCSI revision: 04
Host: scsi34 Channel: 00 Id: 00 Lun: 00
  Vendor: OPNFILER Model: VIRTUAL-DISK     Rev: 0   
  Type:   Direct-Access                    ANSI  SCSI revision: 04

我的部署 yaml 文件:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql-test
  labels:
    tier: db
    system: test
    name: mysql
spec:
  replicas: 1
  template:
    metadata:
      name: mysql
      labels:
        name: mysql
        tier: db
    spec:
      containers:
        - name: mysql
          image: linhnm/lab:linhnm-wp
          volumeMounts:
            - mountPath: /var/lib/mysql
              name: pv-sql
      volumes:
        - name: pv-sql
          iscsi:
            targetPortal: 172.20.30.76:3260
            iqn: iqn.2006-01.com.openfiler:tsn.11934dc96acf
            lun: 0
            fsType: ext4
            readOnly: false
  selector:
    matchLabels:
      tier: db
      name: mysql

我的 K8s 集群无法创建 pod,describe pod 命令中的事件如下:

Events:
  Type     Reason                  Age               From                     Message
  ----     ------                  ----              ----                     -------
  Normal   Scheduled               3m                default-scheduler        Successfully assigned mysql-test-7f5d55b8d8-tdxkk to worker1
  Normal   SuccessfulAttachVolume  3m                attachdetach-controller  AttachVolume.Attach succeeded for volume "pv-sql"
  Normal   SuccessfulMountVolume   3m                kubelet, worker1         MountVolume.SetUp succeeded for volume "default-token-wqhhj"
  Warning  FailedMount             1m                kubelet, worker1         Unable to mount volumes for pod "mysql-test-7f5d55b8d8-tdxkk_default(bef99831-8cc9-11e8-a98d-00505695a133)": timeout expired waiting for volumes to attach or mount for pod "default"/"mysql-test-7f5d55b8d8-tdxkk". list of unmounted volumes=[pv-sql]. list of unattached volumes=[pv-sql default-token-wqhhj]
  Warning  FailedMount             43s (x8 over 2m)  kubelet, worker1         MountVolume.WaitForAttach failed for volume "pv-sql" : failed to get any path for iscsi disk, last err seen:
Could not attach disk: Timeout after 10s

谁能告诉我我应该如何调整我的实验室?或者我应该阅读什么材料来解决这个问题?谢谢

【问题讨论】:

  • 其实这个好像没问题。您是否遵循了一些教程或使用了这个示例? github.com/kubernetes/examples/tree/master/staging/volumes/… 如果是,我认为这是一个错误。尝试在 github 上感受一下问题:github.com/kubernetes/examples/issues
  • 嗨 Aurelius,我之前读过那个链接,但没有任何帮助。其实我不认为这是一个错误,可能是我在某个地方错了。
  • 指令很清楚,你的 yaml 看起来很好。如果这不起作用,这可能意味着它是一个错误,我建议在 github 上发布一个问题并让我们保持更新。

标签: kubernetes iscsi


【解决方案1】:

最后,我认为我找到了导致问题的原因。它可能是我的 openfiler iscsi 服务器。在使用 targetd 创建另一个 linux iscsi 服务器并将我的卷清单更改为新的属性后,K8s 集群可以创建 pod,然后顺利附加卷。

【讨论】:

    猜你喜欢
    • 2016-09-30
    • 1970-01-01
    • 2016-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-04
    • 2015-09-01
    • 2019-02-16
    相关资源
    最近更新 更多