N
N
Nastya19202021-09-17 17:19:08
Kubernetes
Nastya1920, 2021-09-17 17:19:08

How to correctly run the script through the chart Job?

You need to create a resource when the service starts. The script does everything necessary (collects data and creates the necessary yaml file in the cluster)
I need the job to run this script, I try to insert it into command and args - I get errors. In the first case "/bin/sh": stat no such file or directory,
In the second case: problems converting yaml to json: or did not find expected key, or did not find expected '-' indicator.

What could be the problem? What did I spell wrong? Completely stuck.

apiVersion: batch/v1
kind: Job
.....

1.

containers:
- name: create-webhook-configuration
image: {{ .Values.image.repository }}{{ .Values.image.name }}:{{ .Values.image.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- /bin/sh
- -c
- >
{{ .Files.Get "scripts/run.sh" }}
  restartPolicy: OnFailure


2.
containers:
- name: create-webhook-configuration
image: {{ .Values.image.repository }}{{ .Values.image.name }}:{{ .Values.image.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["/bin/sh", "-c", {{ .Files.Get "scripts/run.sh" }}]
  restartPolicy: OnFailure

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question