https://www.cnblogs.com/lanheader/p/14153839.html
##创建PV
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: xxl-job-admin-logs-pv
labels:
pv: xxl-job-admin-logs-pv
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
nfs:
server: xxxxx
path: /data/k8s
---
##创建pvc
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: xxl-job-admin-logs-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5Gi
selector:
matchLabels:
pv: xxl-job-admin-logs-pv
---
##创建xxl-job
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: xxl-job-admin
labels:
name: xxl-job-admin
spec:
replicas: 1
selector:
matchLabels:
name: xxl-job-admin
template:
metadata:
labels:
name: xxl-job-admin
spec:
containers:
- name: xxl-job-admin
image: xuxueli/xxl-job-admin:2.1.0
ports:
- containerPort: 8080
env:
# 替换yaml文件中的mysql地址
- name: PARAMS
value: "--spring.datasource.url=jdbc:mysql://192.168.8.224:3306/xxl_job?Unicode=true&characterEncoding=UTF-8&useSSL=false --spring.datasource.username=root --spring.datasource.password=root123 --spring.mail.username=716@qq.com --spring.mail.password=abcd"
volumeMounts:
- mountPath: /data/applogs
name: xxl-job-admin-logs
volumes:
- name: xxl-job-admin-logs
persistentVolumeClaim:
claimName: xxl-job-admin-logs-pvc
---