【问题标题】:Identify nodes of Persistent Volume Claims识别持久卷声明的节点
【发布时间】:2021-07-14 01:37:49
【问题描述】:

全部,

有没有办法找到与 Persistent Volume Claim 关联的节点。

> kubectl 获取 pvc -n 命名空间

给了我持久卷声明的列表。但我还需要与每个声明相关联的节点。

即使描述 PVC 也不会给我节点

kubectl 描述 pvc pvcname -n 命名空间

谢谢,
格拉吉

【问题讨论】:

  • 你检查过pv的详细信息吗?
  • 我确实在 PV 和 PVC 上运行了 kubectl describe,但它们不包含节点名称。
  • 如果你描述 pod,你应该看到 node info 和 pvc info。
  • 节点不一定与 PV/PVC 关联

标签: kubernetes azure-aks persistent-volume-claims


【解决方案1】:
  • 每当 POD 使用 PVC 时,kubernetes 都会创建一个名为 volumeattachment 的对象,其中包含附加 pvc 的节点信息。
   - kubectl get volumeattachements | grep <pv name> // to get the volumeattachment name
   - kubectl describe volumeattachment <volumeattachment name from above command> | grep -i 'node name'

【讨论】:

  • 是否可以获取绑定的 pod 名称?
  • 我找不到任何直接找到它的方法,但解决方法是kubectl get pvc --all-namespaces -o json | jq -j '.items[] | "\(.metadata.namespace), \(.metadata.name), \(.spec.volumeName)\n"' | grep &lt;pvc name&gt;
猜你喜欢
  • 1970-01-01
  • 2019-02-01
  • 1970-01-01
  • 2018-12-21
  • 1970-01-01
  • 2019-04-11
  • 2021-03-28
  • 2019-08-11
  • 1970-01-01
相关资源
最近更新 更多