https://www.cnblogs.com/lanheader/p/14153839.html

    1. ##创建PV
    2. ---
    3. apiVersion: v1
    4. kind: PersistentVolume
    5. metadata:
    6. name: xxl-job-admin-logs-pv
    7. labels:
    8. pv: xxl-job-admin-logs-pv
    9. spec:
    10. capacity:
    11. storage: 5Gi
    12. accessModes:
    13. - ReadWriteMany
    14. persistentVolumeReclaimPolicy: Retain
    15. nfs:
    16. server: xxxxx
    17. path: /data/k8s
    18. ---
    19. ##创建pvc
    20. ---
    21. kind: PersistentVolumeClaim
    22. apiVersion: v1
    23. metadata:
    24. name: xxl-job-admin-logs-pvc
    25. spec:
    26. accessModes:
    27. - ReadWriteMany
    28. resources:
    29. requests:
    30. storage: 5Gi
    31. selector:
    32. matchLabels:
    33. pv: xxl-job-admin-logs-pv
    34. ---
    35. ##创建xxl-job
    36. ---
    37. apiVersion: apps/v1
    38. kind: Deployment
    39. metadata:
    40. name: xxl-job-admin
    41. labels:
    42. name: xxl-job-admin
    43. spec:
    44. replicas: 1
    45. selector:
    46. matchLabels:
    47. name: xxl-job-admin
    48. template:
    49. metadata:
    50. labels:
    51. name: xxl-job-admin
    52. spec:
    53. containers:
    54. - name: xxl-job-admin
    55. image: xuxueli/xxl-job-admin:2.1.0
    56. ports:
    57. - containerPort: 8080
    58. env:
    59. # 替换yaml文件中的mysql地址
    60. - name: PARAMS
    61. 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"
    62. volumeMounts:
    63. - mountPath: /data/applogs
    64. name: xxl-job-admin-logs
    65. volumes:
    66. - name: xxl-job-admin-logs
    67. persistentVolumeClaim:
    68. claimName: xxl-job-admin-logs-pvc
    69. ---