k8s local volume 和host path volume的区别

Posted elnino

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了k8s local volume 和host path volume的区别相关的知识,希望对你有一定的参考价值。

k8s提供多种volume接口,其中local 和host path是容易混淆的两个接口。下面这篇文章解释了两者的区别:

https://groups.google.com/forum/#!topic/kubernetes-users/68Yvm8ZkztI

关键内容:
Both use local disks available on a machine. But! Imagine you have a cluster of three machines and have a Deployment with a replica of 1. If your pod is scheduled on node A, writes to a host path, then the pod is destroyed. At this point the scheduler will need to create a new pod, and this pod might be scheduled to node C which doesn‘t have the data. Oops!

Local volumes fix this by ensuring a pod is scheduled to the machine where the data exists.

以上是关于k8s local volume 和host path volume的区别的主要内容,如果未能解决你的问题,请参考以下文章

K8s之deploy挂载Volumes

k8s的PV/PVC

K8s的PV/PVC

K8S pod hosts和resolv.conf

k8s之volumes持久化存储

k8s Volume