I am trying to create a Kubernetes cronjob. During the deployment, I get this error:
Error: UPGRADE FAILED: YAML parse error on lemming-metrics/templates/lemming-metrics-cronjob.yaml: error converting YAML to JSON: yaml: line 16: mapping values are not allowed in this context
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: {{ .Values.name }}
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
spec:
serviceAccountName: {{ .Values.lemming_metrics.kubeServiceAccount }}
containers:
- name: {{ .Values.name }}
image: {{ .Values.image.repository }}
tag: latest
imagePullPolicy: Always
resources: {{ toYaml .Values.resources }}
args:
- /usr/bin/python
- /opt/lemming_metrics.py
env:
- name: REGIONS
value: {{ .Values.lemming_metrics.regions}}
- name: ECS_CLUSTER
value: {{ .Values.lemming_metrics.ecs_cluster}}
restartPolicy: OnFailure
backoffLimit: 2
activeDeadlineSeconds: 90
Thanks for any help in advance
Helm uses a packaging format called charts. A chart is a collection of files that describe a related set of Kubernetes resources.
If you want to use helm you have to use it proper. Please check Helm guide. If you want to apply it usingkubectl
you have to write cronjob from documenation. Please provide more information if you are using HELM – PjoterS