I am using a PVC with ReadWriteOnce access mode, which is used by a logstash Deployment which will run a stateful application and use this PVC.Each pod in the deployment will try to bind to the same persistent volume claim. In case of replicas > 1, it will fail (as it supports ReadWriteOnce, only the first one will be able to bind successfully). How do I specify that each pod is to be bound to a separate PV.
I don't want to define 3 separate yamls for each logstash replica / instance
apiVersion: apps/v1
kind: Deployment
metadata:
name: logstash
spec:
replicas: 3
template:
metadata:
labels:
app: logstash
spec:
containers:
image: "logstash-image"
imagePullPolicy: IfNotPresent
name: logstash
volumeMounts:
- mountPath: /data
name: logstash-data
restartPolicy: Always
volumes:
- name: logstash-data
persistentVolumeClaim:
claimName: logstash-vol
Need a way to do volume mount of different PVs to different pod replicas.