I have a set of Kubernetes cronjobs that I want to run. The Persistent Volume Claim is ReadWriteOnce. There will be one job which updates the data on the volume, and the other jobs will read the data. The pvc can only be bound to one node at a time, but my understanding (this may be wrong) is that other pods can mount it read-only provided they are scheduled on the correct node. (Obviously only one pod can mount it read/write.)
I see that I can schedule two pods on the same node using podAffinity, but is there a way to use affinity to select the node that has the pvc attached? Or is it possible in GKE to do this? My claim looks like this:
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-persistent-volume
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Gi
storageClassName: standard