gpt4 book ai didi

kubernetes - k8s : error converting YAML to JSON: yaml: line 33: found character that cannot start any token

转载 作者:行者123 更新时间:2023-12-05 08:29:48 39 4
gpt4 key购买 nike

希望你一切都好

我得到了那个错误:错误:

将 YAML 转换为 JSON 时出错:yaml:第 33 行:找到不能开始任何标记的字符

在我的 k8s 集群上尝试部署此 cronjob 时,能否请您检查并让我知道您是否有任何关于出现此错误的原因的线索?

文件如下:

---
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

---

最佳答案

改变:

              value: %%AWS_REGION%%

到:

              value: "%%AWS_REGION%%"

Strings containing any of the following characters must be quoted.

:, {, }, [, ], ,, &, *, #, ?, |, -, <, >, =, !, %, @, `

无法在 kubernetes 文档中找到,但来自 ansible yaml syntax:

In addition to ' and " there are a number of characters that arespecial (or reserved) and cannot be used as the first character of anunquoted scalar: [] {} > | * & ! % # ` @ ,.

关于kubernetes - k8s : error converting YAML to JSON: yaml: line 33: found character that cannot start any token,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68010441/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com