希望你过得很好,
我得到了一个错误:错误:
error converting YAML to JSON: yaml: line 33: found character that cannot start any token
当试图在我的k8s集群上部署这个cron作业时,请检查并告诉我是否有任何关于发生此错误的原因的线索?
档案如下:
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: resourcecleanup
spec:
# 10:00 UTC == 1200 CET
schedule: '0 10 * * 1-5'
jobTemplate:
spec:
template:
metadata:
annotations:
iam.amazonaws.com/role: arn:aws:iam::%%AWS_ACCOUNT_NUMBER%%:role/k8s/pod/id_ResourceCleanup
spec:
containers:
- name: resourcecleanup
image: cloudcustodian/c7n
args:
- run
- -v
- -s
- /tmp
- -f
- /tmp/.cache/cloud-custodian.cache
- /home/custodian/delete-unused-ebs-volumes-policies.yaml
volumeMounts:
- name: cleanup-policies
mountPath: /home/custodian/delete-unused-ebs-volumes-policies.yaml
subPath: delete-unused-ebs-volumes-policies.yaml
env:
- name: AWS_DEFAULT_REGION
value: %%AWS_REGION%%
volumes:
- name: cleanup-policies
configMap:
name: cleanup-policies
restartPolicy: Never
---发布于 2021-06-16 22:25:54
改变:
value: %%AWS_REGION%%至:
value: "%%AWS_REGION%%"必须引用包含下列任何字符的字符串。 :,{,},,,&,*,#,?,-,<,>,=,!,%,@,`
在kubernetes文档中找不到,而是从ansible yaml语法:找到的
除了‘和“之外,还有许多字符是特殊的(或保留的),不能用作未引号标量的第一个字符:[] {} >AC.26*&!%#`@,。
发布于 2022-04-12 01:29:19
问题可能来自于缩进方法,尝试使用空格而不是缩进选项卡。每个缩进使用两个空格。希望这能有所帮助。
https://stackoverflow.com/questions/68010441
复制相似问题