what are differences between hostpath and local volume?

2,784 views
Skip to first unread message

nohkw...@gmail.com

unread,
Dec 14, 2017, 3:22:48 AM12/14/17
to Kubernetes user discussion and Q&A
Hi, all

I'm searching the simplest volume to store data with hadoop containers.

so I was trying to test hostpath and local volumes.

but I failed to create a local volume in my cluster (# of nodes is 3)


What are differences between hostpath and local volumes?

I read a official document but I wasn't able to understand exactrly.


https://kubernetes.io/docs/concepts/storage/volumes/#local

Brandon Philips

unread,
Dec 14, 2017, 4:22:09 PM12/14/17
to kubernet...@googlegroups.com
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.

--
You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-use...@googlegroups.com.
To post to this group, send email to kubernet...@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.
--
CTO, CoreOS, Inc
Tectonic is enterprise Kubernetes

nohkw...@gmail.com

unread,
Dec 14, 2017, 9:33:59 PM12/14/17
to Kubernetes user discussion and Q&A
first of all, thank you for your reply.

if I use statefulsets (not deployments), is there any difference between hostpath and local volumes?

I think that features of local volumes are similar to those of statefulsets

https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#using-statefulsets


2017년 12월 15일 금요일 오전 6시 22분 9초 UTC+9, Brandon Philips 님의 말:

Michelle Au

unread,
Dec 15, 2017, 2:01:19 AM12/15/17
to Kubernetes user discussion and Q&A
Hi,

Local volumes is an alpha feature currently, so some extra steps are needed to get it working.  I would be happy to help you out on slack.

It is designed for use with stateful sets and provides data gravity by always scheduling your pod to the correct node.

It also works much better than hostpath when you have heterogeneous disk configuration between your nodes.

Let me know if you have further questions.

Thanks,
Michelle

To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-users+unsubscribe@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages