对齐文件规范
This commit is contained in:
28
ansible/files/05-06/openlist-backup-cronjob.yaml
Normal file
28
ansible/files/05-06/openlist-backup-cronjob.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
# docs/05-06-openlist挂载网盘与自动备份.md — 替换镜像与 PVC 名
|
||||
apiVersion: batch/v1 # CronJob 所属 API:batch/v1
|
||||
kind: CronJob # 定时任务:CronJob
|
||||
metadata: # 资源元信息
|
||||
name: openlist-backup # CronJob 名称
|
||||
namespace: default # CronJob 所在命名空间
|
||||
spec: # CronJob 期望状态
|
||||
schedule: "0 3 * * *" # 任务调度:每天 03:00(cron 格式)
|
||||
jobTemplate: # 每次触发生成的 Job 模板
|
||||
spec: # Job spec
|
||||
template: # Job Pod 模板
|
||||
spec: # Pod spec
|
||||
containers: # 容器列表
|
||||
- name: openlist-backup # 容器名
|
||||
image: your-registry/openlist-backup:latest # 镜像(需替换为你的镜像)
|
||||
args: # 容器启动命令参数
|
||||
- /bin/sh # 使用 shell
|
||||
- -c # shell 执行模式
|
||||
- /backup.sh # 运行脚本
|
||||
volumeMounts: # 挂载卷
|
||||
- name: backup-target # 引用 volumes[].name
|
||||
mountPath: /backup # 容器内挂载目录
|
||||
volumes: # 卷列表
|
||||
- name: backup-target # 卷名(与 volumeMounts 对齐)
|
||||
persistentVolumeClaim: # 使用 PVC 作为存储来源
|
||||
claimName: openlist-backup-pvc # 绑定的 PVC 名称(需保证存在)
|
||||
restartPolicy: OnFailure # Pod 失败后重启策略:仅失败时重启
|
||||
|
||||
Reference in New Issue
Block a user