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?
Yes, use nfs shares for your baremetal cluster.
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.