Giter VIP home page Giter VIP logo

Comments (3)

ak2766 avatar ak2766 commented on June 10, 2024

Yes, cronjobs in Kubernetes aren't exactly like cronjobs on a server. I'm thinking you might need to read up on sidecar containers. But having never used them myself, that's as far as my recommendation goes.

My tool of choice in Linux is a BASH script so I tend to tackle all manner of problems in kubernetes with scripts. To that end, I'd get the Dockerfile used to build Matomo and add a script just before going to the Entrypoint. Say you want to run a cleanup process every hour, I'd do this:

CMD [ "while true; do cleanup; sleep 3600; done" ]

NOTE: This is untested code but I hope you get the gist.

from kubernetes.

basavrajdevpuje avatar basavrajdevpuje commented on June 10, 2024

@ak2766 Thank you for your reply. It really helped me to get closer to the answer. I used command: [] (i.e. CMD [] as you mentioned) in my CRON job to get it done.

I also got to know that we cannot create a cron job for a running pod. But we can reuse the PVC used by the running pod by setting a POD AFFINITY rule in the CRON JOB which matches the label of the same pod.

from kubernetes.

justmeandopensource avatar justmeandopensource commented on June 10, 2024

@ak2766 thanks for helping.

from kubernetes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.