patternyamlkubernetesMinor
Running two containers in a kubernetes job each with their own initContainers
Viewed 0 times
eachwithkubernetestworunningowncontainersjobtheirinitcontainers
Problem
In this SO article I understand that I can run a sequence of
https://stackoverflow.com/questions/40713573/how-to-run-containers-sequentially-as-a-kubernetes-job
I have two independent containers, each of which requires a sequence of
Is it possible to run both sequences of
It's not valid to duplicate
initContainers before running the containers defined in spec.template.spec.containers. https://stackoverflow.com/questions/40713573/how-to-run-containers-sequentially-as-a-kubernetes-job
I have two independent containers, each of which requires a sequence of
initContainers to run in series prior to the container running.Is it possible to run both sequences of
initContainers at the same time? Something like this:apiVersion: batch/v1
kind: Job
metadata:
name: my-test-job
spec:
backoffLimit: 0
template:
spec:
initContainers:
- name: init1
image: busybox
command: ["echo", "Init 1 Ran!"]
containers:
- name: task1
image: busybox
imagePullPolicy: Always
command: ["echo", "Task 1 Ran!"]
restartPolicy: Never
spec:
initContainers:
- name: init2
image: busybox
command: ["echo", "Init 2 Ran!"]
containers:
- name: task2
image: busybox
imagePullPolicy: Always
command: ["echo", "Task 2 Ran!"]
restartPolicy: NeverIt's not valid to duplicate
spec as I did in that example of what I'm attempting to achieve. But it demonstrates the sequence of events I want. Initially init1 and init2 kick off, and once each finishes, task1 and task2 start following their respective init containers.Solution
What you are describing is best achieved by either using two jobs or let task 1 also be an init Container as they run in sequence.
Alternatively you could use Argo Workflows.
https://github.com/argoproj/argo
Alternatively you could use Argo Workflows.
https://github.com/argoproj/argo
Context
StackExchange DevOps Q#11262, answer score: 2
Revisions (0)
No revisions yet.