am trying to use
gke-gcsfuse/volumes: "true" in CronJob, but there is no provision as well as documentation available to use the csi driver.
The only documentation is https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/cloud-storage-fuse-csi-dri... which doesnot look feasible for CronJob.
What can we do for loading csi fuse driver with Cron Job?
My CronJob looks like:
apiVersion: batch/v1 kind: CronJob metadata: name: hello namespace: my-namespace spec: schedule: "*/1 * * * *" concurrencyPolicy: Allow startingDeadlineSeconds: 100 suspend: false successfulJobsHistoryLimit: 3 failedJobsHistoryLimit: 1 jobTemplate: spec:
template: metadata:
spec:
containers:
- name: hello
image: busybox
args:
- /bin/sh
- -c - date; echo "Hello, World!"
volumeMounts:
- mountPath: /cron-jobs
name: cron-scripts
restartPolicy: OnFailure
serviceAccount: k8-prod-service-account
volumes:
- name: cron-scripts
persistentVolumeClaim:
claimName: cronjob-gcs-data-claim
Hello @ravi_p,
Thank you for contacting Google Cloud Community.
I believe that you have self resolved your issue by appending a Job template in CronJob Schema. Example cornjob YAML manifest:
apiVersion: batch/v1
kind: CronJob
metadata:
name: hello
namespace: my-namespace
spec:
schedule: "*/1 * * * *"
concurrencyPolicy: Allow
startingDeadlineSeconds: 100
suspend: false
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
metadata:
annotations:
gke-gcsfuse/volumes: "true"
spec:
serviceAccount: my-k8-service-account
containers:
- name: hello
image: busybox
args:
- /bin/sh
- -c
- date; echo "Hello, World!"
volumeMounts:
- mountPath: /cron-jobs
name: cron-scripts
restartPolicy: OnFailure
volumes:
- name: cron-scripts
persistentVolumeClaim:
claimName: cronjob-gcs-data-claim
For the users having the similar issue, please refer to this link.
I hope the above information is helpful 🙂
Thanks & Regards,
Manish Bavireddy.