Run sidecar once

how to configure a workload sidecar so that runs once only?

thanks vincent for the reply.

i was intending to create a sidecar that will run once after the main container is ready.

according to the definition of provided in the following link it looks like i need to create a standard container.

https://rancher.com/docs/rancher/v2.x/en/k8s-in-rancher/workloads/add-a-sidecar/

so the question is how to configure a standard container type sidecar so that it run only once?

That is not a thing in k8s as far as I know… depending on your definition of “once” (per pod? Ever?) you may be able to do something with the downward API or touching and checking for a file.

how to do that once per pod.

also how to create something like a k8s job ---- https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/

or how can i mention “restartPolicy: Never” from rancher 2?

1 Like

The only thing I have found is to create a unique label for a pod, have everything shared I need for the job in a configmap and then create a new workload of the job type (which can be selected from the up-right of “more options” in the workload type), and finally tell that job to run once per pod of that label.