gpt4 book ai didi

kubernetes - 将 YAML 转换为 JSON : did not find expected key 时出错

转载 作者:行者123 更新时间:2023-12-02 11:35:16 26 4
gpt4 key购买 nike

我刚刚创建了一个新的 Helm 图表,但是当我运行时 helm install --dry-run --debug我得到:

错误:多相机跟踪/模板/多相机跟踪.yaml 上的 YAML 解析错误:将 YAML 转换为 JSON 时出错:yaml:第 30 行:未找到预期的键

这是我的 Yaml 文件:

---
# apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: multi-camera-tracking
annotations:
Process: multi-camera-tracking
labels:
io.kompose.service: multi-camera-tracking
spec:
serviceName: multi-camera-tracking
replicas: 1
selector:
matchLabels:
io.kompose.service: multi-camera-tracking
podManagementPolicy: "Parallel"
template:
metadata:
labels:
io.kompose.service: multi-camera-tracking
spec:
containers:
- name: multi-camera-tracking
env:
- name: MCT_PUB_PORT
value: {{ .Values.MCT_PUB_PORT | quote }}
- name: SCT_IP_ADDR_CSV
value: {{ .Values.SCT_IP_ADDR_CSV | quote }}
- name: SCT_PUB_PORT_CSV
value: {{ .Values.SCT_PUB_PORT1 | quote }}, {{ .Values.SCT_PUB_PORT2 | quote }}
image: {{ .Values.image_multi_camera_tracking }}
#name: multi-camera-tracking
ports:
- containerPort: {{ .Values.MCT_PUB_PORT }}
resources:
requests:
cpu: 0.1
memory: 250Mi
limits:
cpu: 4
memory: 10Gi
readinessProbe:
exec:
command:
- ls
- /tmp
initialDelaySeconds: 5
periodSeconds: 60
restartPolicy: Always
#imagePullSecrets:
#- name: wwssecret
---
apiVersion: v1
kind: Service
metadata:
annotations:
Process: multi-camera-tracking
creationTimestamp: null
labels:
io.kompose.service: multi-camera-tracking
name: multi-camera-tracking
spec:
ports:
- name: "MCT_PUB_PORT"
port: {{ .Values.MCT_PUB_PORT }}
targetPort: {{ .Values.MCT_PUB_PORT }}
selector:
io.kompose.service: multi-camera-tracking
status:
loadBalancer: {}

奇怪的是我已经创建了多个其他 Helm chart ,它们都与此非常相似,但是这个不起作用并产生错误。

最佳答案

我找到了它不起作用的原因。首先,允许有逗号分隔的值,但有问题的部分是引号。

这是错误的语法:

value: {{ .Values.SCT_PUB_PORT1 | quote }}, {{ .Values.SCT_PUB_PORT2 | quote }}

这是正确的:
value: {{ .Values.SCT_PUB_PORT1 }}, {{ .Values.SCT_PUB_PORT2 }}

关于kubernetes - 将 YAML 转换为 JSON : did not find expected key 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58861962/

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