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.
GKE lets you create disks to store data and this storage area can be linked to multiple pods.Notice that your cluster and disk must be in same zone/region.
gcloud compute disks create disk1 --zone=zone_name
now you can use this disk to store data from pods . This is a simple mongodb replicationcontroller yaml file that uses disk1 .This might not be an efficient way but its the simplest one that I know.
apiVersion: v1
kind: ReplicationController
metadata:
labels:
name: mongo
name: mongo-controller
spec:
replicas: 1
template:
metadata:
labels:
name: mongo
spec:
containers:
- image: mongo
name: mongo
ports:
- name: mongo
containerPort: 27017
hostPort: 27017
volumeMounts:
- name: mongo-persistent-storage
mountPath: /data/db
volumes:
- name: mongo-persistent-storage
gcePersistentDisk:
pdName: disk1
fsType: ext4
disk 1 will exists even your pod get deleted or replaced.
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
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! ;)