我有一个带有 2 个副本的简单部署。
我希望每个副本都有相同的存储文件夹(共享应用程序上传文件夹)
我一直在玩索赔和数量,但还没有优势,所以寻求快速帮助/示例。
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