0

We plan to set up a ES cluster using Kubernetes. The k8s pod will consist of 3 data nodes and we intend to have persistent volume mapping for the data.

I am new to both ES and k8s but as I understand, in a pod, a volume is usually shared. But in this case, we should not share the data of the 3 instances. What is the best way to achieve volume mapping for a pod. If I have 3 instances, should I map each separately like /node1/data, /node2/data or should I just map to a single volume '/data' and ES will ensure that that data between the instances is isolated?

I am not sure if mapped volume should have node names like node1, node2 etc as explained above. Is the pod design of having 3 ES nodes (or multiple data nodes) correct? Can you specify different persistent volumes for different node instances in a pod?

What happens if the pod is terminated and a new pod is created? Should there be a strong binding between the mapped volume and nodename. What is the best practice to achieve this?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Dhopu K
  • 5
  • 4

1 Answers1

0

For starters, to some extent it depends on how your cluster is provisioned/run. If you run on a decent cloud provider, kube will be able to support you with automatic creation of PV for your PVC (Persistent Volumes).

Did I understand correctly that you plan to have 3 nodes inside one pod? That does not sound right. You should have 3 separate pods forming your cluster. As this is a stateful service, you might want to look into StatefulSet

Having correctly defined PVC in your cluster pods, kube will make sure that they are correctly bound to your pods (ie. on AWS AZ always schedule node in correct zone so that it can link that pods EBS based PV).

I would suggest you to start building the cluster using emptyDir volume in your pod definition, and when you get a hang of it, you can move on to making sure that your data is correctly persisted when pods are deleted and recreated with update of your Deployment or StatefulSet.

Sidenote: while inside pod singe volume can be mounted in multiple containers of that pod, not many backends support ReadWriteMany access mode allowing mounting the same volume to different pods (ie. NFS does)

Radek 'Goblin' Pieczonka
  • 21,554
  • 7
  • 52
  • 48
  • I thought that a pod should contain all the instances of a cluster. From your answer, I am wrong. A cluster can consist of multiple Pod's. So a Pod can be just one node of a cluster. In ES, we have other node types like 'master-only' and 'client-only' and these can be also be in different pods. correct? – Dhopu K Jul 24 '17 at 08:52
  • Exactly. In kube, pod is the smallest organisational unit that is scheduled on the node. It is rare to use Pod directly, as it's usually abstracted by use of Deployments, DaemonSets, StatefulSets or Jobs. You should create your clusters by means of these higher level constructs, most often you will utilize Deployments or StatefulSets – Radek 'Goblin' Pieczonka Jul 24 '17 at 11:40