How to use HostPath in kubernetes baremetal?

4/5/2019

For persistant volume in kubernetes i can use HostPath . But my problem is if one of my pods is restarted and created in other node.

How can i handle this? I am in baremetal envinroment.

should i use NFS?

-- yasin lachini
kubernetes

2 Answers

4/5/2019

Yes, use nfs shares for your baremetal cluster.

-- P Ekambaram
Source: StackOverflow

4/8/2019

As @P Ekambaram has already commented in the last comment below his answer, you might consider to use nodeSelector within your Pods by specifying the corresponded label to achieve scheduling Pods on specific Nodes, or via more comprehesive method by adapting nodeAffinity which conceptually brings the same approach but with more flexible options: like requiredDuringSchedulingIgnoredDuringExecution and preferredDuringSchedulingIgnoredDuringExecution. You can find out more relative information in the official Kubernetes documentation.

-- mk_sta
Source: StackOverflow