验证数据时出错:[ValidationError(CronJob.spec.jobTemplate.spec.template.spec): io.k8s.api.core.v1.PodSpec 中的未知字段 "container",
error validating data: [ValidationError(CronJob.spec.jobTemplate.spec.template.spec): unknown field "container" in io.k8s.api.core.v1.PodSpec,
这是我试图用于创建 cronJob 的 yaml 文件。我在 io.k8s.api.core.v1.PodSpec,
中收到类似未知字段“容器”的错误
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: abc-service-cron-job
spec:
schedule: "* * * * *"
jobTemplate:
spec:
template:
spec:
container:
- name: abc-service-cron-job
image: docker.repo1.xyz.com/hui-services/abc-application/REPLACE_ME
imagePullPolicy: Always
command:
- /bin/sh
- -c
- date; echo Hello from the Kubernetes cluster
restartPolicy: OnFailure
apiVersion: batch/v1beta1
kind: CronJob
metadata:
...
spec:
...
jobTemplate:
spec:
template:
spec:
containers: # <-- you have spelling error here, should be "containers"
...
这是我试图用于创建 cronJob 的 yaml 文件。我在 io.k8s.api.core.v1.PodSpec,
中收到类似未知字段“容器”的错误apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: abc-service-cron-job
spec:
schedule: "* * * * *"
jobTemplate:
spec:
template:
spec:
container:
- name: abc-service-cron-job
image: docker.repo1.xyz.com/hui-services/abc-application/REPLACE_ME
imagePullPolicy: Always
command:
- /bin/sh
- -c
- date; echo Hello from the Kubernetes cluster
restartPolicy: OnFailure
apiVersion: batch/v1beta1
kind: CronJob
metadata:
...
spec:
...
jobTemplate:
spec:
template:
spec:
containers: # <-- you have spelling error here, should be "containers"
...