Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

326
Views
Ejecute el comando `buscar` dentro de Kubernetes CronJob

No se pueden eliminar archivos con más de un día de antigüedad del volumen montado. Mi yaml:

 apiVersion: batch/v1beta1 kind: CronJob metadata: name: cfs-cleanup spec: concurrencyPolicy: Forbid schedule: '0 4 * * *' successfulJobsHistoryLimit: 0 failedJobsHistoryLimit: 10 jobTemplate: spec: backoffLimit: 2 activeDeadlineSeconds: 600 template: metadata: annotations: sidecar.istio.io/inject: "false" spec: restartPolicy: Never containers: - name: cfs-cleanup image: alpine:3.13.2 command: ["find", "/root/volumes/nginx-cache/cfs* -type f -mtime +1 -exec rm -f {} \;"] volumeMounts: - name: cache mountPath: /root/volumes/nginx-cache volumes: - name: cache hostPath: path: /root/volumes/nginx-cache type: DirectoryOrCreate

el contenedor falla sin un error y no hace nada. ¿Podría ser que el comando se ejecute antes de que se monte el volumen?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Solo estoy adivinando, pero a tu mando

 command: ["find", "/root/volumes/nginx-cache/cfs* -type f -mtime +1 -exec rm -f {} \;"]

la ruta /root/volumes/nginx-cache/cfs* no se expandirá.

Para verificarlo, simplemente pruebe command: ["ls", "/root/volumes/nginx-cache/cfs*"]

Puede intentar envolver su comando en sh -c ... como

 command: ["sh", "-c", "find /root/volumes/nginx-cache/cfs* -type f -mtime +1 -exec rm -f {} \;"]

Además, su comando posiblemente sea completamente incorrecto. Fusionó todos los argumentos de find ejecutable en una sola cadena (lo que no debería ser un problema cuando se invoca a través de sh -c ... .

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!