I have to run Kubernetes job, Only One pod and one time execution (No Parallel pods are needed). Terminate Job once task is done.
My application is developed using python, this is how i am running manually
python3 app.py -input-file big_file_config.json -run_type job
My job file:
apiVersion: batch/v1
kind: Job
metadata:
name: loader-triiger
spec:
backoffLimit: 5
activeDeadlineSeconds: 60000
template:
spec:
containers:
- name: loader-triiger
image: ""
command: ["appy.py", "-input-file", "big_file_config.json", "-run_type", "job"] # how to pass inputfile to kubernetes job pod
imagePullPolicy: Always
resources:
limits:
memory: "16048Mi"
cpu: "16000m"
restartPolicy: Never
Dockerfile:
FROM python:3.8-slim-buster
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
COPY . .
# run Application
ENTRYPOINT ["python3"]
I can upload json input file directly to docker image, but image size increases and also, each time input chnages need to build a docker image.
so it is great to provide option that support command line arrguments to accept input file to kuberenets job pod. Any help greatly appreciated
You could use configmap to achieve this.