Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to store data in a Kubernetes cluster

How does pods that are controlled by a replication controller and "hidden" behind a service in Kubernetes write/read data? If I have an application that recieves images from the user that needs to be persisted, where do I store that? Because of the service in front I have no control over which node it is stored at if I use volumes.

like image 940
LuckyLuke Avatar asked Nov 21 '25 00:11

LuckyLuke


2 Answers

I think the "simple" answer to your question is that you will need shared storage under you Kubernetes cluster, so that every pods access the same data. Then it wouldn't matter where the pods are running and which pod is actually executing the service.

May be another solution would be Flocker, they describe themself in short:

Flocker is a data volume manager and multi-host Docker cluster management tool. With it you can control your data using the same tools you use for your stateless applications by harnessing the power of ZFS on Linux.

Anyway I think the storage question on Kubernetes or any other dockerized infrastructure is very interesting.

It looks like the google-app-engine doesn't support sharing data store between their apps by default like they pointed out in this SO Question

like image 191
joh.scheuer Avatar answered Nov 23 '25 13:11

joh.scheuer


If you are running in Google Compute Engine, you can use a Compute Engine persistent disk (network attached storage) that is bound to the pod, and moves with the pod:

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

We'd like to support other types of network attached storage (iSCSI, NFS, etc) but we haven't had a chance to build them yet. Pull requests welcome! ;)

like image 36
brendan Avatar answered Nov 23 '25 13:11

brendan