Schedule a POD on-demand

Hi team,

I’m using AKS for my kubernetes cluster. Master is managed by azure and i don’t see any option to check the master or access the master.
I have a requirement from my dev team. They wanted to schedule a POD on-demand. For eg. they wanted to run a pod for 10 mins and destroy it. sometimes for 15 mins, 30 mins and destroy it. Is this something we can do using kube scheduler. If yes , how can we do that. Please help.

Thanks,
Sun

Have you looked at the cron-job object?

https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/

For on-demand scheduling I think a Job object would work. It’s advantageous to use a Job over a bare pod because kube will ensure that the job runs to completion even if a node restarts and kills your pods. See here for details.

To schedule jobs to run for different lengths of time I think you’ll need multiple Job yaml files. Maybe something like:

apiVersion: batch/v1
kind: Job
metadata:
  name: app
spec:
  template:
    spec:
      containers:
      - name: app
        image: 
        command: ["<command>", "--length=<num-minutes>"]
      restartPolicy: Never
  backoffLimit: 4