获取 Kubernetes FlexVolume 日志

Get Kubernetes FlexVolume Logs

我正在尝试创建一个自定义的 FlexVolume,但它 attach/mount 失败并显示超时消息。我在哪里可以找到日志以确定失败的原因?

这是我的 StatefulSet 规范:

kind: StatefulSet
...
spec:
  ...
  template:
    ...
    spec:
      ...
      volumes:
        - name: "ignite-storage"
          flexVolume:
            driver: "co.mira/lvm"
            fsType: "ext4"
            options:
              awsRegion: "us-east-1"
              vols: "2"
              tag: "ignite"
              ebsType: "{{ ignite_storage_ebs_volume_type }}"
              sizeGb: "{{ ignite_storage_ebs_volume_size_gb }}"
              iopsPerGb: "2"
      containers:
        - name: ignite
          ...
          volumeMounts:
            - name: "ignite-storage"
              mountPath: "..."

我的 FlexVolume 使用守护进程部署在所有节点上:/usr/libexec/kubernetes/kubelet-plugins/volume/exec/mira.co~lvm/lvm

如前所述here

供应商和驱动程序名称必须与卷规范中的 flexVolume.driver 匹配,其中“~”替换为“/”。

虽然您有 driver: "co.mira/lvm" 和供应商名称 mira.co~lvm

kube-controller-manager 负责附加和分离(如果启用),因此在 [=] 的主机上查找 attachdetachisattached 13=]。如果它部署在自己的 kube-system pod 上,请使用:kubectl -n kube-system logs -f $POD_NAME.

对于操作 waitforattachmountdeviceunmountdevice 检查每个节点上的 kubelet 日志尝试 /var/log/kubelet.logjournalctl -u kubelet.service.

init 操作应记录在两者中。