I have a simple deployment with 2 replicas.
I would like that each of the replicas have same storage folder in them (shared application upload folder)
I've been playing with claims and volumes, but haven't got the edge still, so asking for a quick help / example.
apiVersion: apps/v1
kind: Deployment
metadata:
name: 'test-tomcat'
labels:
app: test-tomcat
spec:
selector:
matchLabels:
app: test-tomcat
replicas: 3
template:
metadata:
name: 'test-tomcat'
labels:
app: test-tomcat
spec:
volumes:
- name: 'data'
persistentVolumeClaim:
claimName: claim
containers:
- image: 'tomcat:9-alpine'
volumeMounts:
- name: 'data'
mountPath: '/app/data'
imagePullPolicy: Always
name: 'tomcat'
command: ['bin/catalina.sh', 'jpda', 'run']
kind: PersistentVolume
apiVersion: v1
metadata:
name: volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 2Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/mnt/data"
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: claim
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi