{
  "id": "kubernetes/volume-mount-failed-hostpath-type-mismatch",
  "signature": "MountVolume.SetUp failed for volume \"my-volume\" : hostPath type check failed: /data/logs is not a directory",
  "signature_zh": "卷 \"my-volume\" 的 MountVolume.SetUp 失败：hostPath 类型检查失败：/data/logs 不是一个目录",
  "regex": "hostPath type check failed: .+ is not a directory",
  "domain": "kubernetes",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The hostPath volume's type is set to 'Directory' but the specified path on the node is a file or does not exist.",
  "root_cause_type": "generic",
  "root_cause_zh": "hostPath 卷的类型设置为 'Directory'，但节点上指定的路径是一个文件或不存在。",
  "versions": [
    {
      "version": "Kubernetes v1.27.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Kubernetes v1.28.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Kubernetes v1.30.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Changing the pod's restart policy to Always",
      "why_fails": "The pod will keep restarting but still fail because the underlying path issue persists.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "Adding a PVC instead of hostPath without understanding the requirement",
      "why_fails": "PVCs require storage classes and may not match the need for node-local storage.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "SSH into the node and create the directory: `ssh node-user@node-ip 'sudo mkdir -p /data/logs'`.",
      "success_rate": 0.95,
      "how": "SSH into the node and create the directory: `ssh node-user@node-ip 'sudo mkdir -p /data/logs'`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the path is a file, change the pod spec to use `type: FileOrCreate` or remove the type field entirely.",
      "success_rate": 0.8,
      "how": "If the path is a file, change the pod spec to use `type: FileOrCreate` or remove the type field entirely.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Check the path on the node with `ls -la /data/logs` to verify its type, then adjust the pod YAML accordingly.",
      "success_rate": 0.9,
      "how": "Check the path on the node with `ls -la /data/logs` to verify its type, then adjust the pod YAML accordingly.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "SSH 到节点并创建目录：`ssh node-user@node-ip 'sudo mkdir -p /data/logs'`。",
    "如果路径是一个文件，将 Pod spec 改为使用 `type: FileOrCreate` 或完全移除 type 字段。",
    "使用 `ls -la /data/logs` 检查节点上的路径以验证其类型，然后相应调整 Pod YAML。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://kubernetes.io/docs/concepts/storage/volumes/#hostpath",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-08-22",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}